1

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?

3
  • I can answer the recommended resource for vim docs: :help.
    – Wuffers
    May 7, 2011 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, 2011 at 18:58
  • 3
    Yes, I did remove the "Thank you". It is unnecessary.
    – Wuffers
    May 7, 2011 at 18:59

3 Answers 3

4

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.

1
  • Thanks, I'll try and adopt the VIM way, I can always use Keyboard Maestro to remap some keys.
    – Naatan
    May 10, 2011 at 16:42
1

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>
2
  • The :maca command is a command specific to MacVim.
    – Wuffers
    May 7, 2011 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, 2011 at 16:43
1

Just gone through all this myself. Quickest and easiest solution on a Mac I've found is: http://pqrs.org/macosx/keyremap4macbook/document.html

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: http://pqrs.org/macosx/keyremap4macbook/extra.html

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.

1
  • 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, 2011 at 16:44

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .