11

I'm new to vim and I'm trying to map a key combo for running the Ack plugin found here: https://github.com/mileszs/ack.vim

I want to map cmd-shift-f to run the Ack command :Ack. I've added the following to ~/.vimrc

nmap <D-F> :Ack<space>

It doesn't work. What am I doing wrong?

I'm using vim 7.3 within iTerm 2 on MacOS X.

Oliver Salzburg
  • 86,445
  • 63
  • 260
  • 306
jordelver
  • 2,251
  • 4
  • 23
  • 29

2 Answers2

5

The problem is that within <...> notation mappings, case is (mostly) insensitive, so you have to explicitly state you want to map with the shift key. Try this:

nmap <D-S-F> :Ack<space>
Heptite
  • 19,383
  • 5
  • 58
  • 71
  • That still doesn't work. It's weird because nmap :Ack works for -f. But it doesn't work with – jordelver Feb 07 '12 at 22:44
  • 1
    Hmm, interesting. `nmap :Ack` does work in MacVim, but not in the terminal. Looks like `cmd` is not recognised in a terminal. – jordelver Feb 07 '12 at 22:57
  • 2
    And finally, according to this page: http://unix.stackexchange.com/questions/29665/in-vim-how-to-map-command-right-and-command-left-to-beginning-of-line-and-e You can only use `` key mappings in a GUI Vim such as MacVim. I've decided to just go with `-f` for now. – jordelver Feb 07 '12 at 23:17
3

Or.. you could think about doing it this way:

nmap <D-F> :Ack <space>

You don't need to mention the shift & this still only triggers with a capital F (so although shift isn't mentioned in the binding, you still have to press it).

This works for me at least.

Jason F
  • 131
  • 2