mapping of C-1

2006-10-25 Thread Roman Pořízka

Hello,
I'm trying to map C-1 to some command (:tabn 1cr) and
unfortunately it's not working :( I'm trying on linux (where this
mapping for mrxvt works) and windows...

Have you any clue why it's not working?

With regards,
Roman Porizka


Re: mapping of C-1

2006-10-25 Thread A.J.Mechelynck

Roman Pořízka wrote:

Hello,
I'm trying to map C-1 to some command (:tabn 1cr) and
unfortunately it's not working :( I'm trying on linux (where this
mapping for mrxvt works) and windows...

Have you any clue why it's not working?

With regards,
Roman Porizka



It's not working because it's not defined.

The following Ctrl + printable key combinations are defined, and since they 
date back to a time when keyboards had neither F keys nor arrow keys, nor even 
Tab or Backspace, sometimes not even an Enter key, they are portable across 
all ASCII-based hardware and software flavours AFAIK:


Ctrl-?  0x7F
Ctrl-@  0x00
Ctrl-A  0x01
Ctrl-B  0x02
...
Ctrl)Y  0x19
Ctrl-Z  0x1A
Ctrl-[  0x1B
Ctrl-\  0x1C
Ctrl-]  0x1D
Ctrl-^  0x1E
Ctrl-_  0x1F
Ctrl-a to Ctrl-z : same as Ctrl-A to Ctrl-Z

A Ctrl function is also defined for most of the non-printable keys, but the 
keycodes are implementation-dependent (they vary from one console terminal to 
the other).


Ctrl + other printable keys is not defined. (Programs reading their keyboard 
in raw mode may sometimes nevertheless identify them, but Vim uses cooked 
mode.)


OTOH, Alt + printable key is usually defined, but in most cases it collides 
with symbols or letters-with-diacritics in the range 0xA0-0xFF.


If you want to define portable key mappings, I recommend choosing among F2 to 
F9, F11, F12, and Shift-F1 to Shift-F12. If you need more, try multikey 
mappings and/or Ctrl-Alt-a to Ctrl-Alt-Z. Some of the latter, however, might 
be pre-empted by your OS and never make it to Vim.



Best regards,
Tony.