Vim Mapping Umlaute: Tips & Fixes

  • Thread starter Thread starter DrDu
  • Start date Start date
  • Tags Tags
    Mapping
AI Thread Summary
When editing German LaTeX files in Vim with a US keyboard, users can map umlauts using imap commands in their vimrc, but may experience issues with cursor movement if typing speed is too slow. The timeoutlen setting, which defaults to 1 second, can be adjusted to improve mapping responsiveness. Some users suggest switching to a German keyboard layout for easier access to special characters, although this can complicate typing LaTeX commands. Alternatives like using abbreviations or adjusting timeout settings can also enhance the experience. Ultimately, finding the right balance in settings is key to efficient editing in Vim.
DrDu
Science Advisor
Messages
6,420
Reaction score
1,003
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 :)
 

Similar threads

Replies
3
Views
4K
  • Sticky
Replies
0
Views
4K
Replies
3
Views
2K
Replies
13
Views
3K
Replies
43
Views
9K
Replies
21
Views
5K
Replies
1
Views
3K
Replies
4
Views
10K
Back
Top