Visual Studio Code Tab Key does not insert a tab

I'm using Visual Studio Code as my code editor. I did a search on google but wasn't able to find anything about my issue.

The issue is simple, pressing ⇥ Tab in the editor does nothing. I'm expecting it to insert 4 spaces.

Anyone know what I can do to get ⇥ Tab working like expected?


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).

From the Visual Studio Code Keybinding docs:

| Key      | Command                                 | Command id                       |
| Ctrl + M | Toggle Use of Tab Key for Setting Focus | editor.action.toggleTabFocusMode |

The current tab control mode should also show up in the status bar:

enter image description here


To fix the issue

Pressing ctrl+M causes the ⇥ Tab key to move focus instead of inserting a ⇥ Tab character.
Turn it off by pressing the shortcut again.

To disable the shortcut

  1. Open "Keyboard Shortcuts" with ctrl+K, then ctrl+S.
    Or go to File > Preferences > Keyboard Shortcuts.
  2. Search for toggle tab key moves focus.
  3. Right Click, Remove Keybinding.

Click "Tab Moves Focus" at the bottom right in the status bar. That's it.

I believe I had clicked on ctrl+M. When doing this, the "Tab Moves Focus" tab/button showed up at the bottom right. Clicking on that makes it go away and starts working again.

enter image description here