Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question
I can answer the recommended resource for vim docs: :help. – Wuffers May 7 '11 at 18:50
Lol you edited "Thank you" out of my post? I'm aware VIM comes with it's own documentation, I was just hoping there was a better alternative. – Naatan May 7 '11 at 18:58
Yes, I did remove the "Thank you". It is unnecessary. – Wuffers May 7 '11 at 18:59
up vote 4 down vote accepted

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.

share|improve this answer
Thanks, I'll try and adopt the VIM way, I can always use Keyboard Maestro to remap some keys. – Naatan May 10 '11 at 16:42

I have no idea where you got the ":maca" command, but it is not a Vim command. Also, what is "_cycleWindowsBackwards:" and "_cycleWindows:"?

I suspect what you really want is something more like this:

:nmap <D-Right> :wincmd W<CR>
:nmap <D-Left> :wincmd w<CR>
share|improve this answer
The :maca command is a command specific to MacVim. – Wuffers May 7 '11 at 19:13
Thanks, I didn't realize I was looking at MacVim specific documentation, I guess I'll need to find a solution that'll work for both. – Naatan May 10 '11 at 16:43

Just gone through all this myself. Quickest and easiest solution on a Mac I've found is:

This utility will allow you to change your Command keys. You may also set up profiles (I set up a VIM profile) so that I just turn on my VIM profile only when in VIM (quick toggle on menu bar) so it doesn't mess anything (mac osx behaviour, utilities or applications) else up.

I'm on a Macbook Pro so I wanted to change my option keys to control keys while in VIM. This utiltiy allowed me to do that and I also changed my fn key to option just in case.

They also have another utility:

Which allowed me to change my Caps Lock key to be Esc. Which is FANTASTIC in VIM; no more reaching for Esc constantly. Note: this utility doesn't have the profiles, so my caps lock is always Esc whether in vim or not.

share|improve this answer
Thanks, I use Keyboard Maestro for my keyboard remapping needs (CMD+C / CMD+V just cripples your fingers..), but I try to avoid using it when there are (supposedly) build in settings to change keys. – Naatan May 10 '11 at 16:44

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.