6

All my life as a developer I was annoyed that on german keyboards some common programming characters are mapped to very awkward combinations:

  • [ = AltGr + 8
  • ] = AltGr + 9
  • { = AltGr + 7
  • } = AltGr + 0
  • \ = AltGr + ß

As I'm touch typing with 10 fingers, I regularly have to leave the standard finger position to type the above characters. While I've somehow got used to it, it still makes me shiver whenever I have to type lengthy combinations of the above symbols.

There are suggestions to use US keyboard layout instead but this again makes it very hard to type the umlauts äöüÄÖÜß.

So i wonder: What smart solutions have other non-english developers come up with to avoid these awkward shortcuts?

I'm primarily interested in workarounds for Windows. But as a vim user I'd also like to hear vim-only solutions.

Michael Härtl
  • 8,428
  • 5
  • 35
  • 62
  • you might want to read http://vim.wikia.com/wiki/Making_Parenthesis_And_Brackets_Handling_Easier or install autopairs http://www.vim.org/scripts/script.php?script_id=3599 –  May 18 '13 at 08:52
  • Duplicate of http://stackoverflow.com/q/4392705 and http://stackoverflow.com/q/8704610. – glts May 18 '13 at 10:15
  • I ended up going with a US-based keyboard but edited to have easy access to the non-US characters I need via AltGr, e.g. in your case the umlauts. I found https://www.kbdedit.com/ to be great for this and worth the few $$. – Rory Nov 29 '21 at 12:31

2 Answers2

4

Not an actual workaround, but an alternative solution that works well for me: use the US keyboard layout for programming.

Vim's choice of keys is closely related to the US keyboard layout. On a US keyboard,

  • / is to ? (Shift/) what n is to N;
  • / is extremely convenient to reach, and unshifted;
  • { and } are in the same place as [ and ], they differ only in shifting;
  • + "line down" and - "line up" are adjacent;
  • : is on the home row;
  • < and > are neighbours;
  • all characters commonly used in programming are accessible with Shift, there is never any need for AltGr or CtrlShift etc. combos.

The last point is especially important. Vim's command language is about eliminating modifier keys so having to use only the Shift modifier is good.

At some point I realized how my keyboard layout held me back. I switched to the US keyboard layout for programming only. I have been doing all my programming and terminal hacking in the past few years on a US layout and I'm very happy with it. Whenever I need to write an email or make notes I can just switch back. The keyboard layout is like a representation of the mindset I'm currently in: US for programming, native for other things.

I say, give it a try.

glts
  • 21,808
  • 12
  • 73
  • 94
  • Thanks, but what do you do if you have to type Umlauts during programming, for example for user messages? – Michael Härtl May 20 '13 at 08:35
  • Switching is a matter of hitting one key in my setup. I admit that it can be annoying, though. On my new job I have colleagues writing their comments in German so I have to do a lot more switching these days. Still worth it. – glts May 20 '13 at 08:43
3

Not only for that reason, but because of the better layout, I learned the dvorak for programmers layout. I don't recommend you to learn the whole layout - it took me monthes to reach my old qwertz-speed.

But the sticking point why this layout is explicitly recommended for programmers is the alignment of the numbers-row. The numbers are in shift-position whereas the symbols are in first position (but in a better alignment as in standard-qwertz and even qwerty). So for example if I hit the qwertz-5 I get ( instead, 8 is ) and so on. Here you can see the whole layout.

You also have to leave the "normal" keys and reach the numbers-row, but if you train it a bit, it feels really awesome inside vim and while programming.

So one option is to customize your standard-qwertz layout (maybe using the Microsoft Keyboard Layout Creator or any other tool) to get the special keys better positioned, like for example in the dvorak for programmers layout.

Another option is using qwerty and remapping the german umlauts to AltGr+a for ä, AltGr+s for ß and so on. That's what I also did with dvorak. It's not that handy as on standard qwertz, but those characters don't occure that often, I think.

Rory
  • 40,559
  • 52
  • 175
  • 261
lslah
  • 556
  • 8
  • 17