mapping <C-/>

15 views
Skip to first unread message

gmguyx

unread,
Jul 24, 2007, 10:45:30 PM7/24/07
to vim_use
I would like to map <Control> + non-alphabetical characters in normal
mode but it doesn't work.

ie, I can do:

nmap<C-a>
nmap<C-b>
etc.

but not:

nmap<C-/>
nmap<C-[>
etc.

Is there a good reason why vim disallows this and is there any way to
circumvent this?

Tony Mechelynck

unread,
Jul 25, 2007, 12:17:15 AM7/25/07
to vim...@googlegroups.com

Control-[ is the Escape key. It can be remapped (I think), but you cannot map
<C-[> and <Esc> to different {rhs}es because (in cooked input mode) they are
indistinguishable. Similarly, you cannot remap Ctrl-a differently than Ctrl-A
(Ctrl-Shift-a) because they are indistinguishable (they both give 0x01).

Control-/ is not portably defined, because / (Ox2F) is a printable character
which is neither in the range [0x3F-0x5F] nor a lowercase letter. Ctrl-\ can
be remapped.

ASCII defines control keys as follows:

- if x is in the range [0x40-0x5F], Ctrl+x = x - 0x40
- if x is a lowercase letter, Ctrl+x is the same as Ctrl+upcase(x)
- Ctrl+? is 0x7F

NON-printable keys, such as the Fn keys or the cursor-movement keys, have
their keychords coded differently. They can be remapped -- if your window
manager lets them reach Vim (mine doesn't).


Best regards,
Tony.
--
Hier liegt ein Mann ganz obnegleich;
Im Leibe dick, an Suden reich.
Wir haben ihn ins Grab gesteckt, Here lies a man with sundry flaws
Weil es uns dunkt er sei verreckt. And numerous Sins upon his head;
We buried him today because
As far as we can tell, he's dead.
-- PDQ Bach's epitaph, as requested by his cousin Betty
Sue Bach and written by the local doggerel catcher;
"The Definitive Biography of PDQ Bach", Peter
Schickele

Reply all
Reply to author
Forward
0 new messages