All of the previous solutions presented here require one of the following fairly brute-force solutions: a global RegEx replacement of space sequences, a copy-'n-paste of a hard-coded Tab character, or toggling from space- to tab-indentation and (hopefully remembering to change) back again once you're done.
While these are all, obviously, valid solutions, in my case I just need to insert the occasional single Tab character without jumping through hoops or Googling for a \t on the Internet (or, at least, through Stack Overflow).
For my solution, I have remembered that you can override the VSCode and VSCodium user key-bindings to allow the insertion of a hard-coded Tab character.
As a bit of background, the vast majority of my code is space character indented, but every now-and-then I will write a "Here Document" in a Shell script, and then I would like the "EOF" string to be indented to the same level as the text. For this to work, I need to manually insert a one-off \t character, not spaces.
Here is my solution:
Go to "Settings" → "Keyboard Shortcuts" → "Open Keyboard Shortcuts (JSON)" → Click on the right panel, which should be "User > keybindings.json".
Insert (or update) the following JSON:
[
{
"key": "ctrl+v tab",
"command": "type",
"args": { "text": "\t" },
"when": "editorTextFocus"
},
{ "key": "ctrl+i",
"command": "type",
"args": { "text": "\t" },
"when": "editorTextFocus"
},
]
This allows you to use either Ctrl-V followed with a Tab or Ctrl-I to insert the Tab character.
Makefilethen see stackoverflow.com/a/56060185/191246