Search code examples
vimvim-fugitive

Map Vim shortcut for Diffget


I'm mapping shortcuts for :diffget //2 and :diffget //3 and :Gwrite! to make merging easier. So far, on the Mac, I have:

map <D-2> :diffget //2<CR>
map <D-3> :diffget //3<CR>
map <D-0> :Gwrite!<CR>

But unfortunately, they don't work. Any ideas?


Solution

  • Your mapping definitions look fine. (You should prefer :noremap, though, as usually, remapping of the right-hand side isn't necessary, and may cause problems.) Especially in console Vim, not all key combinations can be used.

    Some key combinations, like Ctrl + non-alphabetic cannot be mapped, and Ctrl + letter vs. Ctrl + Shift + letter cannot be distinguished. (Sorry, I don't know much about the Mac.) This is a known pain point, and the subject of various discussions on vim_dev and the #vim IRC channel.

    In insert or command-line mode, try typing the key combination. If nothing happens / is inserted, you cannot use that key combination.