-1

I'm using a Mac and trying to configure Vim extension for VS code.

My issue is that I like to use caps lock as my Escape but in Vim

For some reason neither Escape or caps lock will allow me to escape INSERT, VISUAL, or NORMAL

I imagine anyone who uses Vim extension in VS code on a Mac would run into this problem.

Any advice or simple step I'm missing?

Peter T. Walker
  • 152
  • 1
  • 12
  • To clarify, are you hoping to make the caps lock key behave like the escape key _only_ in VSCode, and not anywhere else in MacOS? Or is it sufficient to switch caps lock and escape in all applications (i.e. at the operating system level)? – RNanoware Mar 29 '23 at 14:38
  • Hi @ RNanoware - I currently have them swapped on the OS level but neither capslock or ESC work to exit INSERT mode using the Vim extension in VS code – Peter T. Walker Mar 29 '23 at 14:49
  • 1
    Although I cannot reproduce the issue, I see that folks on other operating systems were able to resolve the issue by setting the `keyboard.dispatch` setting to `"keyCode"` in VSCode. (see https://stackoverflow.com/a/50875402/2977638) Does that help in your case as well? – RNanoware Mar 29 '23 at 14:57

2 Answers2

0

@RNanoware helped me solve this by looking at keybindings.json directly and removing existing conflicting keybinds

Peter T. Walker
  • 152
  • 1
  • 12
0

You should remap caps to esc. I would also suggest to use jj for exiting insert mode. Just add this in settings.json

     "vim.insertModeKeyBindings": [
    {
      "before": ["j", "j"],
      "after": ["<Esc>"]
    }
  ],
D3N2
  • 1
  • 3