Vim multiple meta keys

為{幸葍}努か 提交于 2019-12-07 13:30:51

问题


Update: It turns out to be a bug in MacVim (or perhaps a feature that has yet to be implemented).


I am trying Vim, coming from TextMate. TextMate has a Ruby plugin where you can type Control+Command+Shift+E, and it will find all the lines in your file that contain "# => ", and it will update them with the inspected result of that line.

I have found the library they use to do this, it's called xmpfilter, and comes with rcodetools.

So I can get Vim to do the same behaviour by typing "mzggVG:!xmpfilter -a" which will highlight the whole file, go to last line mode, and pass the contents to xmpfilter, and then replace the highlighted contents with the result.

But I want to map it to the same key combination that TextMate uses, so that it has the same interface, because this has become a huge piece of my workflow.

Here are a bunch of examples of how I have tried to make this work

:nmap <silent> <D-C-E> mzggVG!xmpfilter -a<cr>'z
:nmap <silent> <S-D-C-e> mzggVG!xmpfilter -a<cr>'z
:nmap <silent> <SDC-e> mzggVG!xmpfilter -a<cr>'z
:nmap <silent> <S-<D-<C-e>>> mzggVG!xmpfilter -a<cr>'z
:nmap <silent> <SDC-e> mzggVG!xmpfilter -a<cr>'z
:nmap <silent> <S-><D-><C-e> mzggVG!xmpfilter -a<cr>'z

But none of those work correctly. It would seem that I can't figure out how to specify multiple meta keys. (As a sanity test, I have verified that :nmap <silent> <S-e> mzggVG!xmpfilter -a<cr>'z does work.) Any help would be appreciated.

(Note: I'm using MacVim on Snow Leopard)


回答1:


If I'm not mistaken the command key is represented by D not M (M is alt I believe). I think you'd want to use <S-D-C-e>. ** Note: AS far as I know the command key only works when you are using the GUI.



来源:https://stackoverflow.com/questions/4982246/vim-multiple-meta-keys

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