VSCode insert tab character manually

Viewed 25635

When using VSCode, most of my files are set to be indented using spaces. However I sometimes wish to insert a literal tab. When I was using vim I'd use <Ctrl>+v <Tab> but that doesn't work with VSCode.

I've been searching and searching and cannot find anything. Please help!

6 Answers

<Alt> <Numpad: 0 0 9>

Still works great!

Strange, Visual Studio Code gives you a clue, but you have to hunt for it.

Turn off "Editor: Detect Indentation" which is ON by default.

After which, it will not assume that a tab is 4 spaces.

Of course, all you have to do is select your spaces, and then you will see "ghost dots" in your selection. If you delete those spaces and then type tab, you will now see 1 "ghost right arrow" when you select it which means now you really have a tab character.

When working on Makefiles, I use Find/Replace using regexes.

Replace ^ (4 spaces - change as appropriate) with \t.

Related