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!
I had accidentally enabled a different mode for the tab key. Fixed it by pressing Cmd + Shift + M (for Mac), or Ctrl + M (for Windows).
Quick-and-dirty solution: Find a tab somewhere else, then copy-paste.
Chances are that you already have a tab character in the file you are editing, but if not you can generate one in another application or text editor.
You can also generate a tab programmatically in a bash shell with the following command (the brackets are optional):
echo -e [\\t]
For your more immediate needs, I have inserted a tab character below...
There is a tab character between these brackets: [ ]
Another approach is to change the tab mode temporarily, as shown here.
I'm not sure if there is a generic solution, but you can setup a keybinding for this:
{ "key": "ctrl+v tab", "command": "type", "args": { "text": "\t" }, "when": "editorTextFocus" }
This keybinding will insert an tab character even when the current mode is spaces.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With