mapping <C-/>

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

mapping <C-/>

gmguyx

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?


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: mapping <C-/>

Tony Mechelynck

gmguyx wrote:

> 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?

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

--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---