views:

61

answers:

2

I'd like some map/remap/nmap/etc. commands to be case sensitive, e.g. "<C-I>" vs. "<C-i>".

I checked Google and :help map, but was unable to find this.

+2  A: 
Jay
This does not work for me in vim or gvim, 7.2.330. Specifically, "map <c-i>" is ignored and "map <c-s-i>" is used when I press 'i' while holding control but not shift. I defined the c-s-i mapping last, and that appears to matter.
Roger Pate
doesn't work; try :map <C-o> k :map <C-S-o> j. Both end up being the latter command (regardless of which order they are input). EDIT -- ditto what Roger said.
gatoatigrado
+2  A: 

It appears you currently can't combine control with case-sensitivity in vim or gvim (I'm using 7.2). I might expect this to be a limitation of terminals for the former, but not the latter.

I tested it by typing this in a buffer:

map <c-i> :echo "c-i"<cr>
map <c-s-i> :echo "c-s-i"<cr>

Yank those lines, then :@" (when executes register " as commands). Verifying the maps with :map <c-i> and <c-s-i> shows the problem: <c-i> is <tab>, and only the last one takes effect, with the shift being ignored.

For alt, <a-i> and <a-s-i> do work as expected in gvim

In terminal vim, those two get mapped to é and É (at least here, check with ":map <a-i>" as above), and typing é/É directly (I use dead keys) does invoke the mapping. Actually doing a-i or a-s-i just enters insert mode.

Of course, non-control and non-alt maps work case-sensitively.

Roger Pate