Vim Mapping Umlaute: Tips & Fixes

  • Thread starter Thread starter DrDu
  • Start date Start date
  • Tags Tags
    Mapping
Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
5 replies · 2K views
Messages
6,423
Reaction score
1,004
When I am editing German Latex files in vim using a us keyboard, I would like to map "a to a-umlaut etc. I added corresponding imap commands in my vimrc and they work in principle.
However I have to type "a" after """ at a certain speed, if not, the cursor jumps from before """ to after it and won't map the sequence any more. Is that standard and can that time be set?
 
Physics news on Phys.org
Hi DrDu
Yes, there is, it's timeoutlen
by default I think it is set to 1s, (1000ms) so it should be enough, but just verify that you don't have something abnormaly low by typing :set timeoutlen and then set it it whatever suits you better in your vimrc.
However, I think it would be best if you added a german or some other european keyboard layout and learn to type the right key, because it would work anywhere out of vim and would give you access to all the other letters without having to map them all :) (and their upper case versions etc.)
 
oli4 said:
Hi DrDu
Yes, there is, it's timeoutlen
by default I think it is set to 1s, (1000ms) so it should be enough, but just verify that you don't have something abnormaly low by typing :set timeoutlen and then set it it whatever suits you better in your vimrc.
However, I think it would be best if you added a german or some other european keyboard layout and learn to type the right key, because it would work anywhere out of vim and would give you access to all the other letters without having to map them all :) (and their upper case versions etc.)

Thank you very much oli, I will play around with timeoutlen.
I know how to type both on an English and on a German keyboard. The point is that it is very nasty to type latex commands on a German keyboard as \[]{}, which are most frequent in latex, all require multiple keys.
After all, one of the advantages of latex is that you are programming text and don't need for that task more than the ASCII characters. However, I am playing around with the spell checker, which runs into problems with words like 'Aufr"aumen'.
 
Ahh yes, of course, you did say it was Latex but I didn't think about how it would make things that much more cumbersome.
timeoutlen is the way to go, I tested it right now with 1000 and 3000 and you will certainly find the sweet spot for you :)
If not, you could also try an abbreviation, that means you would have to add a space (and hit backspace) every-time, but maybe it can suits you better, I use abbreviations in emacs for some of those letters (greek mostly but some other 'mathematical formula' related symbols) and it works well enough

Cheers...
 
Ok, I read the help on timeout:
If you don't like timeout for mappings like me, it is advisable to "set notimeout" and "set ttimeout". Then a timeout is still applied with key codes.
 
It has to be a matter of taste, I would tend to set that timeout as as short as possible, because otherwise, if you want to just type " you have to interrupt the sequence with two cancelling keystrokes.
But there are certainly cases where it is a winning strategy
for instance, if you have this habit of, when you do want to write " you are aware you will close them, so you hit ""← and therefore there is no cost :)