Ask HN: Europeans, what keyboard layout do you use for programming?

8 points by hannes0 ↗ HN
Hi all, I want to get more serious with programming and realised that I have to learn touch typing. However, all the symbols for programming are on my German Mac Keyboard layout very hard to reach. I feel like everyone with an english keyboard has an advantage here. Just changing to the American layout wouldn't work, because I have to use umlaute, such as äöüß.

So, how do you do it? What layout do you use, especially if you're native to a language with special characters?

Additionally, if you are using not using a qwerty / qwertz layout, how well does it work with vim?

36 comments

[ 3.3 ms ] story [ 89.5 ms ] thread
I use bépo, which is a keyboard layout designed for French. It’s not perfect for programming but I’m used to it and it’s still much better than Azerty or Qwerty.

Someone is building a new layout named optimot. It is optimised for French and English, and also taking programming into account. The author is doing a good job to test his layout with various kind of usage. I will probably learn it once it’s stable.

Vim is fine. I did remap a few keys in my Vimrc about 15 years ago, to get the shortcuts physically placed in the same way than a Qwerty layout.

Some text editors emulating vim can read my vimrc directly, or I have to remap the keys for them as well. It takes a little time once in a while but it’s worth it.

(comment deleted)
Does macOS not allow you to have multiple keyboard layouts and switch between them with a shortcut?

On Linux I use fcitx to cycle through half a dozen keyboard layouts depending on which language I want to type in.

Particularly for British/Irish keyboard layouts, macOS tends to misbehave and decide that the keyboard is ANSI (it isn't) and that there is a layout for "British - PC" that fits that is just the US mac layout (I guess it's just the default in macOS), so I like to touch that option in macos as little as possible because it does the wrong thing 7 times out of 10.
I briefly considered and discounted a Mac based on keyboard , do they allow remapping now? The physical layout is still trash but remapping may help.

To clarify, it's not just apple - this trend of putting left slash above enter (ANSI) needs to stop, unofficial iso is just so much better.

There's no UI tool to remap individual keys, no.

It has supported installing custom keyboard layouts for a decade though. e.g. this one attempts to workaround mac os insisting you have an ANSI keyboard by installing a layout that makes mac os do the right thing when it's in that bad state: http://liyang.hu/osx-british.xhtml (Updated for Sierra: https://github.com/cbaggers/backup-uk-keyboard-layouts-for-m...)

It feels a little ridiculous having to hack around stupid design decisions for keyboards tbh
I use a compose key and the British layout. It’s fine for French, Spanish and German at least, and I can add my own sequences (e.g. for logical notation).
I use the french layout at work and the U.S one on my imported (from the U.S) laptop. It hasn't been a detriment either way. I've also typed with a french keyboard using the U.S layout or inversely for convenience, occasionally. Both have worked fine with vim, even though I find vim pointless (unless you're sshing into a remote machine).

I have to say, the premise is wrong, you don't need to learn touch typing to be serious about programming. A good programming hour is 60 lines of code (heavy generalization, don't nitpick pointlessly), you don't need to type fast, you don't even need shortcuts or macros or whatever fancy IDEs or editors people spend endless time arguing about.

Don't make the mistake of doing the things you find satisfying (buying books, nice keyboards, customizing your IDE and OS for ultimate productivity, ...) instead of the things that are actually productive and hard: Actually programming something.

I'd recommend listing the things you think you have to do to be serious about programming, and plotting them on a 2D graph where the x-axis is how hard they are, and the y-axis is how much better they'll make you at programming. That will make it clear what you must do.

Thanks for the reply! i'm afraid this is exactly the inconvenient truth i needed to hear and i'm avoiding the real work by looking at keyboard layouts instead. The idea with the matrix sounds good, i will try that!
I‘ve bought a ten less US layout qwerty keyboard (Keychron K3) for my programming work. There is a neat feature on macOS to type ‘Umlaute’. Just long press vowels and you can choose from all possible variations of the vowel. I’ve also build a custom Helidox Corne keyboard, but couldn’t learn the new typing system… (https://thomasbaart.nl/2018/11/26/corne-keyboard-helidox-bui...)
I use an Irish keyboard layout (physically identical to a UK keyboard layout, just some extra dead key combinations).

It's sometimes annoying when video game consoles tell you to use ~ but they've mapped it to the raw keycode and you need to use ` instead, or with syntax that assumes ` is an easy key to type (fenced code blocks, looking at you), but it's not worth fighting years of muscle memory to change where I know quotes, @, # etc. are. If I was to put that effort in I may as well learn dvorak or something.

Keyboard is standard Italian layout but i actually use eurkey because it has a US layout (which i find more comfortable for symbols) + all the accented variants for European languages (using altgr and letters). Pretty optimal for me.
I use US keyboard layout for programming, then change layout with alt+shift if I need to type string with non-English letters and then change back to continue programming. Changing the layout takes a fraction of the second and is really not a problem.
I moved from a German keyboard on a Mac to a US keyboard four years ago. And it definitely helped me to be able to touch type when programming.

I installed the USGerman Keyboard Layout [1] in macOS and have been using it ever since. It puts the umlauts at `alt + a|o|u|s` making it easy enough to type German texts as well.

[1] https://hci.rwth-aachen.de/usgermankeyboard

This looks like a good option. Thanks!
I use a Dvorak layout for more comfortable touch typing, along with some changes I made to the numeric row to make it more suited for programming. For the "native" letters I use a European keyboard and map the extra key to Compose, instead of using AltGr. This will require some substantial investment in retraining, though. (In Vim the cursor keys are a little weird because they are based on placement, but the rest is mostly OK as they are mnemonics).

If you want to take the low effort route, I would just go for the US layout; on MacOS you can use the Option key to get the umlaut dead key. (On Windows, you would use the US International layout). Try this out for a while to see how often you really use the accented characters, compared to all the symbols used in programming; my guess is that you'll find it to be an insignificant bother.

us querty for ages, i never use the accented characters my language has as it is easy to understand the meaning of what i type even without them. i think the same would apply to german
Unfortunately not possible in German, and doesn't look professional. Maße is a different word than Masse. Or zahlen or zählen, drucken or drücken, konnte or könnte…
American English QWERTY. (Swedish QWERTY is cruel and unusual.)
Dane here. The default Danish keyboard is going to give you RSI/kill your hand 100%, because you need to type right alt+shift+7 to do an open squishing bracket. That requires you to turn your hand almost to its limits, and it is painful to do.

As a consequence everybody I know changes their layout to us english or something similar and then switch back when they need to type in danish for an email or a message.

I switched to programmer dvorak a long time ago, but I have no idea how well it works with vim.

Switching input options shouldn't be hard. On my work linux it is alt space (I think), on my personal mac I can either press fn or just hold down the key needed to select the special danish characters. So if I need to write to somebody that it is time to harvest the apples I can use hold down the a key to select æ and the o key to select ø (the message would then be "vi skal til at høste æblerne"), or switch over to a Danish keyboard and type the message directly.

But every OS since DOS has a simple shortcut to change your input language.

Danish and German layouts look quite similar. Interesting that switching the layouts is so common. I guess I'm going to try that and see how well it goes. Thanks!
I am using ANSI US layout even on ISO keyboards for programming.

But honestly, I can’t be sure if I’m touch typing or not. All I know, I can type at decent speed without noise and looking to keyboard.

International English. I like the L shaped return key. To type, for instance, ö, ó or whatever, I just press and hold the o key and select the adequate version with a number.
US, with the typical ANSI (long) return key.

The trick is to use right alt as compose key. This way I can write virtually any character (e.g. á, ß, §, ō...) in an intuitive way. E.g. ø = Compose / + o, æ = Compose a + e, etc.

I regret not using ANSI much sooner. I switched 10 years ago and I couldn't be happier. All symbols are in the right place, which helps a lot when programming.

This sounds good. What system do you use? This is a custom keyboard setting then, right?
Linux. Any Xorg will support this. I think support in Wayland is not complete.
Not op, but I use this system which has instructions for installing to Linux, Windows, and macOS. [1]

It's described as "QWERTY for Western European languages" and supports quite a few characters with simple AltGr (right alt) key combos. Alt+o = ö Alt+a = ä

(American living in Europe, I haven't wanted to move from US QWERTY physical layout, but needed an extended character set in daily use)

[1] https://altgr-weur.eu/

I always use UK layout.
MacOS + AZERTY layout + Vim + no touch-typing, here. It's all fine.