Meino Christian Cramer wrote:
From: "A.J.Mechelynck" <[EMAIL PROTECTED]>
Subject: Re: Mapping german umlauts
Date: Sun, 08 Oct 2006 17:28:51 +0200
Meino Christian Cramer wrote:
[...]
PS:
There is still a question open to me, Tony...
On a german keyboard you have to press Ctrl-AltGr-9 to jump to
a tag under the cursor, which is originally Ctrl-].
This again is bad finger-Yoga (at least for my fingers...;)
This is one reason why I wanted used the umlauts in normalmode to act
as "[","]","{" and "}" (no one needs gemran umaluts in normal mode,
so I will loose nothing...)
Unfortunately Ctrl-umlaut-a (umlaut-a is mapped to ] now...) does not
work as tag-inator. Is this one of these
certain-special-keys-cannot-be-used-in-mappings problem, is this due
to the "nnoremap" (instead of nmap...), which forbids later
re-remapping, do I have to remap this sepeartely or am I simply to
stupid ? ;)
Keep hacking II !
mcc
Mapping something to ] doesn't map anything to Ctrl-], you have to do it
separately.
On my Belgian keyboard on SUSE Linux, CTRL doesn't work with any nonalphabetic
printable key (in particular, it doesn't work with "]"). There are two solutions:
a) Use the mouse (double-clicking a help hyperlink activates it)
b) Use a mapping.
I use
:map <F9> <C-]>
but of course you can use any {lhs} that suits you if you don't like F9. Since
this key has no counterpart you might for instance map ß to it, since no one
needs the eszett in Normal mode either.
Best regards,
Tony.
Hi Tony,
things are becoming better !
Using the umlauts for "{","[","]" and "}" makes things a lot easier
and far more convenient.
But there are still things I dont understand...as always...sorry...
I did the following:
" LATIN SMALL LETTER SHARP S
noremap <Char-252> <C-]>
" LATIN CAPITAL A WITH DIAERESIS
noremap <Char-196> }
" LATIN CAPITAL O WITH DIAERESIS
noremap <Char-214> {
" LATIN SMALL A WITH DIAERESIS
noremap <Char-228> ]
" LATIN SMALL O WITH DIAERESIS
noremap <Char-246> [
which works in normal mode. In insert mode the umlauts appears as
umlauts as it should be. But: WHY?
If I understood the according help correctly "noremap" is a short
form of "no remap". And it is not bound to any mode -- and
"_n_noremap" (for example) is bound to normal mode.
Therefore (according to my obviously wrong logic...;) the above
mapping would apply also to insert mode. But it does not (and it
should not, since the umlauts are needed in insert).
More mysteriously: Using "nnoremap" -- as I think it would make the
above mappings only to apply in normal mode -- for the above mappings
breaks everything: no "{","[","]" or "}" at the umlaut-keys in normal
mode.
The other thing what I tried was to map "every" ( "every" = what I
could find and thought it would be nice to have ) combination of
"something" and the "{","[","]","}" to combinations with the umluat
keys in the appropiate mode.
I wrote:
noremap <Char-228->Char-228 ]]
noremap <Char-246-Char-246> [[
noremap <Char-246-Char-228> []
noremap <Char-228-Char-246> ][
which works with the "mysterious charme" as described above as far as
I could test it (normap <-> nnoremap)
Then I did:
vnoremap <a-Char-246> a[
vnoremap <a-Char-228> a]
vnoremap <i-Char-246> i[
vnoremap <i-Char-228> i]
vnoremap <a-Char-214> a{
vnoremap <a-Char-196> a}
vnoremap <i-Char-214> i{
vnoremap <i-Char-196> i}
for the motions in visual mode -- and it fails totally.
Again I got stuck.
Thanks a lot for any help in advance ! :O)
Keep hacking!
mcc
see ":help map-overview" (and don't be afraid to scroll).
":map" or "noremap" don't map to any mode, they map to Normal, Visual and
Operator-pending but not to Insert and Command-line modes. To map to both
Insert and Command-line, use ":map!" with bang (which doesn't map to Normal
etc.). In general the same {rhs} has totally different effects in Insert and
Command-line modes ("character entry modes") than in the other modes, so this
distinction is sensible.
To map two characters using <> notation, use for instance
:noremap <Char-228><Char-246> ][
just like you would map, let's say, ":map <F5> <Up><Up><Home>" to move two
lines up and go to the left margin. Each <> group represents exactly one
keypress, possibly including modifiers like Shift, Ctrl, Meta and/or Alt
(and/or Command on the Macintosh).
Your vmaps are also in error. <a-something> means "with the Alt modifier" and
<i-something> doesn't mean anything AFAIK. Keep the a's and i's outside the <>
if you mean an actual a or i keypress.
But what's wrong with your original set of (single key) mappings? They should
produce (and more economically) the same results as all the two-key
combinations you could imagine. Oh -- and ":noremap" is not a short form of
":no remap" (the latter doesn't work), it's a variant of ":map" which forbids
remapping.
Best regards,
Tony.