How to map mac command key in vim?

痞子三分冷 提交于 2021-02-06 14:58:46

问题


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


回答1:


It is true that <D- maps to command key. You can see it by :help <D-.

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

The best shot for your intention is to map the combination as hex code, sending to terminal.

Still I will not recommend doing this. command is too important for mac os environment. For example, anyone uses an input method can't map it to command+space.\

Please consider using the usual method here: <leader>.




回答2:


iTerm2 can do this - here I mapped command enter to :wq




回答3:


With IdeaVim you can use: <M-*>



来源:https://stackoverflow.com/questions/40990454/how-to-map-mac-command-key-in-vim

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!