On 01/04/09 04:52, John Beckett wrote:
>
> MisterW wrote:
>> Gvim 72 on XP won't let me map certain ctrl key combinations.
>> Specifically it won't map any of CTRL 1 through to 10. If I
>> type
>>
>> CTRL-V CTRL-1
>>
>> I get nothing. Only 2 and 6 actually print anything. Other
>> applications make use of these keys, and vim itself uses
>> CTRL-6. Is there something that can be done to make this work?
>
> No. The problem is that Vim is designed to be portable; it works
> on many operating systems and tries to minimise the amount of
> special code used for dealing with a particular OS.
>
> It's not Ctrl-6, it is Ctrl-^ which is part of the venerable
> ASCII system. There is a lot more than you want to know at
> http://en.wikipedia.org/wiki/ASCII
>
> If you search for "^^" on that page (Ctrl-^) you will see the
> list of valid Ctrl keys.
>
> I know this news is a bit shocking, but I've found that as I
> learned more of the Vim way of doing things, my desire to map
> commands to weird character combinations has declined.
>
> John

Indeed.

Instead of Ctrl-1, which is not portable, not ASCII, and unknown to 
Vim's "cooked" input mode, you may want to map one of the following 
nearby keys instead (based on my Belgian keyboard):

²       (the key just left of the "one" key)
³       (the same, with Shift)
<S-F1>  (Shift-F1)
Note: F1 without Shift is an alias for ":help" in Vim so you might not 
want to use that as the {lhs} of a mapping. Otherwise most Fn and 
Shift-Fn keys are "safe" to use a {lhs}es in Vim. Other "safe" keys for 
Normal mode but usually not Insert mode, are any keys producing 
upper-ASCII codes -- these will depend on your national keyboard: à, ç, 
ù, é, è, µ and £ on my Belgian keyboard, probably ø and Ø in Danish or 
Norwegian, ł in Polish, ß and possibly umlauted vowels in German, á é í 
ó ú in Spanish, etc.

The first two example mappings above use upper-ASCII characters, namely 
(on my keyboard) 0xB2 and 0xB3; Shift-F1 is accessible to application 
programs on every OS where I've worked. (Ctrl-F1 isn't accessible to 
gvim, or to any other X11 GUI, in my present openSUSE system, where the 
KDE winmanager preempts it for "switch to virtual desktop #1.)


The only "printable keys" whose Ctrl counterparts are defined in (7-bit) 
ASCII and therefore usable by Vim are the following:

- 0x40 to 0x5F including all Latin uppercase: the Ctrl combo maps to the 
result of bitwise AND with 0x1F;
- Latin lowercase, which are aliases for the corresponding uppercase;
- the question mark 0x3F, whose Ctrl counterpart is DEL 0x7F.

If some of them are not on your keyboard, you can use something like the 
following (which I use because I'm not sure if and where the Ctrl-] key, 
a very useful key for help and tag navigatyion in Vim, exists on my 
keyboard):

        :noremap        <F9>    <C-]>


Best regards,
Tony.
-- 
A student, in hopes of understanding the Lambda-nature, came to
Greenblatt.  As they spoke a Multics system hacker walked by.  "Is it
true," asked the student, "that PL-1 has many of the same data types as
Lisp?"  Almost before the student had finished his question, Greenblatt
shouted, "FOO!", and hit the student with a stick.

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

Reply via email to