1

I want to map cmd-left/right to W and w to navigate splits. So I tested right from the command line (in normal mode):

:map <D-Left> <C-w>W 

And it works like a charm. When I had the same line (minus the colon, obviously) in my .vimrc, the mapping is not set.

The closest question I found seem to be related to cygwin only. I also don't believe I am running against a terminal hijacking issue (launching macvim from the finder doesn't change the behaviour) nor does CMD-left/right seem to be an OS wide shortcut.

I must be missing something terribly simple here but I can't find out what.

Thanks in advance for any help/hints

6
  • (1) Use nnoremap instead of map. (2) How can you tell the map isn't set? What is the output of: :map <D-Left>? Commented Jul 18, 2015 at 14:13
  • Just an auxilliary remark: you wrote "minus the colon, obviously", but it is allowed to use the colon at the beginning of a line in a vim script, even if it looks better without Commented Jul 18, 2015 at 14:37
  • @lcd047 Sorry I should have said. Result is * <Home> which is the behaviour I see (going the beginning of line). Same behaviour with nnoremap. Commented Jul 18, 2015 at 15:08
  • Then you have something else that sets the same key combination. Sadly, there is no easy way to tell what that something might be. Commented Jul 18, 2015 at 15:13
  • You can try :verbose map <D-Left> to find in which script the mapping were defined for the last time Commented Jul 18, 2015 at 15:14

1 Answer 1

1

You can try :verbose map <D-Left> to find in which script the mapping were defined for the last time

Sign up to request clarification or add additional context in comments.

1 Comment

This actually allowed me to find that Macvim has .gvimrc which is sourced after ~/.vimrc, In the case of <D-Left>, you can prevent MacVim to set a bunch of HIG compatible mappings by using let macvim_skip_cmd_opt_movement=1. For those interested, the file is located in /Applications/MacVim.app/Contents/Resources/vim/gvimrc (there is also a .vimrc).

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.