Hacker News new | ask | show | jobs
by kleiba 743 days ago
You can remap keys on any keyboard layout, no need to get a Japanese keyboard.

Many years ago, I was working in a German lab and their keyboard layout is really impractical for programming in C-like languages because all commonly used symbols are really awkward to type. I wasn't well-versed in XFree86 then (or today for that matter) but I remember I could solve the problem by simply changing they map that Emacs uses to map keyboard keys to input events. In other words, I was still using a German keyboard but when I typed "blindly", it behaved like a US keyboard. I even had some keys to behave context-sensitively, i.e., the same key stroke would produce different symbols depending on where the cursor was positioned in a buffer. That was actually tremendously useful.

So, if you wanted some other key to give you and underscore without having to hold down Shift (which I don't get why this is a problem in the first place, it's not like we don't have auto-complete in our IDEs), there's multiple ways you could achieve it.

7 comments

Seeing as it wasn't mentioned, there's a Ukelele[0] app for making keyboard layouts for macOS. After installing a layout, switching is as easy as tapping 'fn' by itself or using the keyboard menu icon. For Windows there's MS Keyboard Layout Creator[1].

[0] https://software.sil.org/ukelele/

[1] https://www.microsoft.com/en-us/download/details.aspx?id=102...

The unmentioned detail is that japan has a narrower spacebar and two extra keys
If you take control over your keymap and break out of the idea that the keycaps have to say what the key actually does, the problem is rarely insufficient keys on the keyboard to do what you want, even before you start mucking around with layers or other fancy things. A key that you want to have at hand, but only occasionally, is fine on a SHIFT-CTRL or CTRL-ALT or CTL-Win setup and very few things are default bound to such shortcuts in general.

If it's only a couple of such keys, it is generally not too difficult to use someone else's keyboard if you need to; slightly annoying but you will recover how to do whatever it is you're doing right now reasonably quickly.

I recently switched to this 64-key keyboard: https://mistelkeyboard.com/products/0a26d32ac1e3b1d2af2896e0... I've got a setup where I put one half on each armrest. After a brief adjustment, it's fine, I've got everything I need at hand, and I use the keyboard like crazy; I have not obsessed over setting up a no-mouse setup, but I can hit the mouse single digit numbers of times per hour pretty easily. There's plenty of keys.

Indeed - I recommend a split keyboard with two split spacebars on both sides. The Ergodox or it's FOSS equivalents are really nice once you program in some useful things and there are many very good keymaps for plug-and-play.
I picked up the (back, del) (enter space) thumbs layout from Kinesis, that feature alone has saved me years of strain, id wager. The shape took a bit of time to get used to but I was back at my average wpm speeds in a couple of weeks. Not as much of a learning curve as Ergodox with its layers but the curve and ortholinear layout take a bit of adapting to, though that's true of the Ergodox too.

I kind of wish split keyboards were standard, instead of the default mode being all squeezed into the same 38cm wide form factor. The MS Natural keyboard was a step in that direction, split keyboard with a JUMBO space bar, but I wouldn't nominate it for the new standard..

While the kinesis doesn't have layers like Ergodox, it does have macros and you can remap keys via the hardware of the keyboard itself. I've been using an Ergodox for a few years now and got used to the layers but found the switches needed replacing a lot sooner (maybe I should have gone with a different set) and found the firmware update process for remapping to be annoying and tedious (even though they've gotten it down to about as few steps as is practical). Ergodox is more powerful in the abstract, though.

Especially on keyboards with blank keycaps. :)
Now that's a blast from the past in typing class. I remember hearing people complaining about this or rather using it as a horror story about the class. Of course by the point in the class you use these, you've passed the point of being expected to know where the keys are and it is pretty much an advanced part of the class.

Not sure if that's your reference or not???

A not insignificant number of keyboard enthusiasts prefer to use blank keycaps. It's often merely an aesthetic choice, but those who like to tinker with custom layouts also favor them because that lets them skip shuffling keycaps around following a layout change.
The last stage of mastery is when you drop the need to prove to the world that you don't need to shuffle keycaps by just keeping the existing ones rather than blanking them out.
Back in the dark ages of having to work in an office with shared space in a cubicle farm, it wasn't unheard of where people would swap their keyboards with others because theirs was not working correctly rather than going through IT to get it looked at--possibly also knowing IT might just shrug their useless shoulders at it. I'm guessing a keyboard with blank keys would prevent that.
You know, it occurs to me that musical instruments have blank actuators (keys, fingerboards, valves, ...); yet that alone doesn't prevent music learners from staring at their hands while playing, and that's a habit that can persist for years or decades even.

People learning typing on computers should be encouraged to keep their eyes where their typing appears on the screen.

It wasn't one of those, but yeah. It wasn't an Optimus keyboard either, unfortunately ;-)
This is the main reason why I just use the US ANSI layout in germany, together with KbdKaz on Windows for umlauts and a lot of other extra characters and accennts: https://www.omega-com.pl/kbdkaz.htm
For a while the pile of crap that is Windows 10 got very drunk about keyboard layouts (maybe in combination with connecting to a remote desktop to a computer with a different set of layouts). Being in Switzerland with Swiss German, French and Italian layouts, and having just German and English on the client computer, it would lie to me and claim the layout is English when it's German, etc, etc, and the control panel would even lose layouts...

Fun fact: amayon.de redirects to amazon.de

A cross-platform alternative is to use the EurKey layout (https://eurkey.steffen.bruentjen.eu/layout.html), allowing you to have the US keyboard layout by default, while using modifier keys for various diacritics common in European languages with Latin script.
> You can remap keys on any keyboard layout

"Yeah but" now you're mucking around with software. It's not simply plug-and-play.

From its first paragraph, this 2012 article acknowledges that it was sparked by a HN discussion¹ about another article² and that the HN discussion already covered the remapping solutions you are again proposing 12 years later.

This article offers the Japanese keyboard idea as an alternative to remapping.

---

1. https://news.ycombinator.com/item?id=3976669

2. https://avdi.codes/underscores-are-stupid/

Should this also be possible with a hardware dongle, for the cases where you can’t control the software?
The German keyboard layout is honestly mindblowing bad for programming