Vim mapping acts different when switching between Mac OS X/Linux

1

I've been working with Vim on two different machines, one running Ubuntu 10.04 (gVim) and the other Snow Leopard (MacVim). I copied my .vimrc file and .vim folder to both, and noticed a few minor differences. 2 questions:

1 . I used Drew Neil's vimcast on indentation and added the following to my .vimrc:

nmap <D-[> <<
nmap <D-]> >>
vmap <D-[> <gv
vmap <D-]> >gv

Which maps Cmd+[ and Cmd+] to indent in/out. In Linux I replaced 'D' with 'C', so that it works with Ctrl+[ / ]. All of that works on both machines, only that on Linux, hitting the Escape key after indenting performs an un-indent action. Any thoughts?

2 . I added some script I found to my .vimrc that enables shifting rows (normal and visual mode) up/down by holding Ctrl and using the up/down keys. It works great on Linux, but doesn't work at all on Mac, and I can't understand why. See my .vimrc file here.

sa125

Posted 2010-08-18T06:27:13.277

Reputation: 916

can you formulate it as one or two questions? – Peter Mortensen – 2010-08-18T06:49:47.087

4On your Linux system, are you using Vim in GUI-mode or in tty-mode (i.e. through a terminal program like xterm, rxvt, Gnome Terminal, et cetera)? Your problem likely is due to the fact that Escape and Control-[ share the same character representation (ASCII 27) and are indistinguishable in a tty-based environment. The GUI version of Vim should be able to distinguish Escape from Control-[, but it may choose not to. – Chris Johnsen – 2010-08-18T07:06:39.010

I use the gui version on both linux and mac (gnome-vim and macvim). Perhaps I'll map it to another key (Ctrl+T / Ctrl+Shift+T). – sa125 – 2010-08-18T07:56:15.003

No answers