Mac – Mapping keys in VIM on Mac

macmacvimvimvimrc

I had a previous problem that was solved, but it seems I am stuck once again.

I'm trying to reassign the keys for switching between Windows to be more intuitive. I've found that you should be able to add the following to your vimrc:

nmap <D-Right> :maca _cycleWindowsBackwards:<CR> 
nmap <D-Left> :maca _cycleWindows:<CR>

Which I've tried but it does not seem to do anything for me. My vimrc is definitely being loaded as when I enter bogus I get an error when starting vim.

I've tried different variations of assigning keys, with none really seeming to do anything.

Also, what is the recommended resource for VIM documentation?

Best Answer

The simplest way is the best way:

nmap <D-Right> <C-w>l
nmap <D-Left> <C-w>h

This answers your question but I don't advise you to go that way.

The first problem you'll encounter is that all of your cmdsomething mappings are going to fail in the terminal.

The second is that MacVim doesn't support multiple modifiers: you won't be able to have CtrlShiftb, for example. Well, it will work but the Shift part will be ignored so you will be limited very quicly.

The third problem will be that you'll fail to commit Vim's commands to memory. The day you'll ssh into a server and use Vim there you'll be lost.

So yeah, you CAN do that but (I think that) you SHOULDN'T.

Instead, learn the Vim way and type :help windows. It will pay. Quickly.

Related Question