3

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)

MPelletier
  • 16,256
  • 15
  • 86
  • 137
Joshua Cheek
  • 30,436
  • 16
  • 74
  • 83
  • I asked a [similar question](http://stackoverflow.com/questions/1456026/can-vim-commands-be-mapped-to-key-combinations-with-1-modifier-e-g-ctrl-alt-v), and the answer I was given worked fine in my case. I was expecting that your first attempt `` would work, but it doesn't. [The link that GWW provided](http://vim.1045645.n5.nabble.com/Maping-Ctrl-Shift-s-problems-td1182827.html) seems to confirm that there is no way to create the mapping that you want to, which is a shame! – nelstrom Feb 13 '11 at 14:33

1 Answers1

2

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.

GWW
  • 43,129
  • 11
  • 115
  • 108
  • Yes, this does seem to be true. I can do, for example, to do it. Or, I can do command+shift+e with , but can't seem to get the control in there. I'll update the question to reflect this. – Joshua Cheek Feb 13 '11 at 03:49
  • Based on this http://vim.1045645.n5.nabble.com/Maping-Ctrl-Shift-s-problems-td1182827.html It appears using ctrl is case insensitive. Perhaps you could use Alt (M) instead of Ctrl (C)? – GWW Feb 13 '11 at 03:51