Warm tip: This article is reproduced from serverfault.com, please click

How do I remap the keybindings to change modes in vscode vim extension from insert to normal mode?

发布于 2020-05-21 17:49:22
  1. How does one change the shortcut to switch between insert mode and normal mode?
  2. Where can I find a list of all vim extension shortcuts and their commands? I searched for them in keyboard shortcuts but you can only search by keybindings which complicates things.

Thanks!

Questioner
James Dowsett-Cooper
Viewed
11
Bryant 2020-12-05 23:52:41
  1. I settled on mapping ^ + [ to the command extension.vim_escape. Additional detail for the community:
    • Open keybindings.json
      • ⇧ + ⌘ + p or ctrl + shift + p by default
      • Enter Preferences: Open Keyboard Shortcuts
      • Select the file icon in the top-right corner of the pane:
        file-icon
    • Add the following JSON object to the list:
      {
      "key": "ctrl+[",
      "command": "extension.vim_escape",
      "when": "editorTextFocus && vim.active && !inDebugRepl"
      }
      
    • Notes:
      • Setting "vim.useCtrlKeys": true in settings.json might also be required
      • I assume that a different escape sequence could also be used
      • I'm using vscodevim.vim version v1.17.2 on macOS
  2. In the keyboard shortcuts UI (not the JSON file), searching for extension.vim_ showed a list of Vim "Commands" that can be sent to the Vim emulator according to their keybindings
    • For example, after performing the above, searching for extension.vim_escape provides the following:
      vim-commands