How to map Mac command key in VIM?

I want to map my NERDTREE toggle to Cmd + space , but I don't know what character the Mac command key in .vimrc represents. I searched and found that we can use 'D' to represent the CMD key from this link, but this will not work. BTW I use vim from the terminal, not MacVim.

+15
source share
3 answers

It is true that <D- displayed by the command key. You can see it at :help <D- .

However, this will not work in vim + terminal . It only works on MacVim . See here

The best shot for your intention is to match the combination as a hex code by sending it to the terminal.

However, I will not recommend this. command is too important for the mac os environment. For example, anyone using an input method cannot match it with command + space . \

Please use the usual method here: <leader> .

+8
source

iTerm2 can do this - here I displayed the enter command: wq

enter image description here

+13
source

With IdeaVim you can use: <M-*>

0
source

Source: https://habr.com/ru/post/1260853/


All Articles