Does anyone know why the following mapping can't work, and how to make
it enable?
" Windows Vista + gVim V7.2
:map <C--> <C-W>w-
:map <C-=> <C-W>w+
':map <C-->/<C-=>' and ':verbose map <C-->/<C--=>', it's OK. i.e.
it's in the map list and hasn't been modified by others map.
------------------------------------------
i tried any <C+Numeric key>, in main keyboard not in keypad, none
could work except <C-6>(interior map by gVim self).
While mapping <A-1>, <A-2>....<A-=>, all of them can work.
Regards,
-William
Because, in ASCII, they are not defined.
What you get when you hit Ctrl and 6 together is probably not Ctrl-6
(which is not defined) but Ctrl-^ (which is defined as 0x1E).
The only Ctrl+printable keys defined by ASCII (and therefore known by
Vim) are the following:
- Ctrl-? (control + Question-mark) is 0x7F (aka DEL)
- If X is in the range 0x40 to 0x5F (including all uppercase letters and
6 non-alphabetic characters) then Ctrl-X = X - 0x40 (eks minus hex-40)
- If x is a lowercase letter, then Ctrl-x is the same as Ctrl+ upcase(x)
That's all. The digits are 0x30 to 0x39 so they aren't included in any
of the above cases, and Ctrl+digit is not defined.
OTOH, if X is in the range 0x00 to 0x7F, Alt+x is x + 0x80. This means
that every 7-bit ASCII character has an Alt counterpart in the upper
half of the Latin1 character set. However, it also means that if you use
accented letters, you should avoid using Alt+something as the {lhs} of
an Insert-mode mapping. For example, to Vim, � (small-e-acute) is the
same as Alt-i (Alt with small-i), so if you map Alt-i to do something,
Vim will also do it when you hit � (similarly, see above paragraphs, for
Tab and Ctrl-I, Esc and Ctrl-[, Enter and Ctrl-M).
Note that the Alt modifier is case-sensitive while the Ctrl modifier isn't.
Best regards,
Tony.
--
For a man to truly understand rejection, he must first be ignored by a
cat.
ASCII-----------------Latin1
Ctrl+0x20 -------> 0x80
Ctrl+0x21 -------> 0x81
...........
Ctrl+0x3F -------> 0x9F
And if so, both Ctrl+digit and Alt+digit can work.
Is 0x80~0x9F occupied by Ctrl+Alt+'x'?
Regards,
-William
> mapping. For example, to Vim, é (small-e-acute) is the same as Alt-i (Alt
> with small-i), so if you map Alt-i to do something, Vim will also do it when
> you hit é (similarly, see above paragraphs, for Tab and Ctrl-I, Esc and
I don't know what Window does -- some programs want to treat Ctrl-I as
other than Tab, Ctrl-M as other than Enter, etc. -- but Vim simply
follows what was set long ago by ASCII (at a time when 7 bits were
thought to be enough for a character and anything happening outside the
borders of the 50 states, and also anything in non-English languages
including Spanish, Yiddish, Cajun and Cherokee, could just as well have
been in outer space), and it leaves, among others, Ctrl+0x20 to
Ctrl+0x3F "undefined".
And yes, Ctrl+Alt+@ is 0x80, Ctrl+Alt+A is 0x81, etc. (in UTF-8 or
Latin1, these 32 characters, 0x80 to 0x9F, are all rarely used
non-printing control characters; in Latin9 aka ISO-8859-15 and in
Windows-1252 some or all of these byte values were attributed to
characters nonexistent in Latin1, and above U+00FF in Unicode, such as
the Euro sign, the French oe and OE digraphs, etc.).
***
*** REMINDER: bottom-posting is the custom in the Vim groups.
*** In other groups, well, "in Rome, do as the Romans do".
***
Best regards,
Tony.
--
"In any world menu, Canada must be considered the vichyssoise of
nations -- it's cold, half-French, and difficult to stir."
-- Stuart Keate
As an winding implementation, Ctrl + digit (Windows Vista + gVim V7.2)
could work by AutoHotKey as fallow:
;-----------------------script used in AutoHotKey--------------------------
;can't distinguish normal/insert mode
#IfWinActive ahk_class Vim
^9::
send, {Esc}^w-
return
^0::
send, {Esc}^w{+}
return
^1::
send, {Esc}^w_
return
#IfWinActive
;---------------------------------------------------------------------------------------
Surely, it's a crude method.
Regards,
-William