VIM Cursor Tab in "insert" mode only

If you’d like to enable Cursor Tab only in insert mode, you can add the following to your settings.json:

  "vim.normalModeKeyBindingsNonRecursive": [
    {
      "before": ["i"],
      "commands": ["editor.action.enableCppGlobally"],
      "after": ["i"]
    },
    {
      "before": ["I"],
      "commands": ["editor.action.enableCppGlobally"],
      "after": ["I"]
    },
    {
      "before": ["a"],
      "commands": ["editor.action.enableCppGlobally"],
      "after": ["a"]
    },
    {
      "before": ["A"],
      "commands": ["editor.action.enableCppGlobally"],
      "after": ["A"]
    },
    {
      "before": ["o"],
      "commands": ["editor.action.enableCppGlobally"],
      "after": ["o"]
    },
    {
      "before": ["O"],
      "commands": ["editor.action.enableCppGlobally"],
      "after": ["O"]
    },
    {
      "before": ["g", "i"],
      "commands": ["editor.action.enableCppGlobally"],
      "after": ["g", "i"]
    }
  ],
  "vim.insertModeKeyBindingsNonRecursive": [
    {
      "before": ["<Esc>"],
      "commands": ["editor.cpp.disableenabled"],
      "after": ["<Esc>"]
    }
  ]

This helps me not get distracted by the Cursor Tab suggestions while I’m thinking, and I hope you find it useful too.

1 Like

Thanks for sharing!

For vscode-neovim with lua config, maybe:

vim.api.nvim_create_autocmd("InsertLeave", { callback = function()
 require('vscode').action('editor.cpp.disableenabled')
 end });
vim.api.nvim_create_autocmd("InsertEnter", { callback = function()
 require('vscode').action('editor.action.enableCppGlobally')
 end });