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.
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].
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
"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.
I believe this is an artifact of JIS_X0201, which is, to my knowledge, the first major Japanese 8-bit encoding and mostly 7-bit ASCII + Katakana (that character set you see in old Japanese video games) and some Japan-specific symbols filling the other half of the 8-bit space.
In it, byte 0x23 was changed from "\" to "¥".
The history is fascinating:
> The 1964 ISO draft reserved the positions 0x24 and 0x5c for first and second currency symbols to be assigned by each country, but it was considered too dangerous in international communications to use currency symbols that could be localized. The ISO committee had two options that to use a generic currency symbol (¤) or to give the dollar ($) and pound (£) signs permanent assignments. It was agreed that the dollar sign was assigned to position 0x24 and the pound sign was to position 0x23. The latter was not required in countries that did not need the pound sign. The JIS committee decided to put the yen sign (¥) in 0x5c (one of the national use positions).
It's legacy lived on in Shift JIS which Window's extended and resulted in Japanese Windows computers having file paths like "C:¥Users¥MyName" and escape sequences like "¥n"
All this to say, my respect for Japanese devs who work with encoding is top-tier.
Maybe it's because I took an actual typing class way back in the dark days of actual clackity-clack type writers, but I don't get the dislike of shift keys. Are these people that learned to type from only playing games or other non-formalized learning to type? Kudos for you learning regardless of the method, I'm just looking at why I don't have the same aversion to the shift keys. I even use the "proper" shift key meaning I use the left shift when using a right hand key and vice-versa.
I never learned to type "properly" and I also don't really care or think about modifier keys. I suspect it's one of those things - like coffee snobs searching for the perfect pourover technique, or steak snobs perfecting their reverse sear - wherein people take a hobby, passion, or profession of theirs and feel a need to hyperoptimize it.
That proper shift technique never clicked with me. I developed a technique whereby I use only the left pinky for shift, and only the right thumb for the spacebar. Thus, for text not requiring shifting, I'm using nine fingers including the right thumb. Yet, I can touch type just about as fast if I lose the left pinky by keeping it planted on the left shift key! FOR INSTANCE, I TYPED THIS SENTENCE WITHOUT LIFTING MY PINKY FROM THE SHIFT KEY.
My technique is efficient in circumstances where I have to type several upper case letters in a row, which happens quite regularly in C programming. Using "proper" shifting for an identifier like UINT_MAX is nonstarter, and using CapsLock before and after is likewise inefficient.
I think the double Shift key design and the related proper technique is a holdover from mechanical typewriters. You need to put a good amount of strength into the shift. It's not as easy to type with your left hand while its pinky is anchored to the Shift key.
I always buy Macbooks with JIS layout, not because underscores are convenient to type. It's convenient to push the かな button to start writing in Japanese then 英数 when finished. On an ASCII keyboard, Mac OS requires either C-<RET> or pushing the Fn key, both of which waste an entire second to display a modal, then another second to actually switch keyboard layout.
I will admit, JIS layout makes writing Clojure a bit easier, though it also makes quoting tedious. Escaping is even more tedious. Push M-¥ is one option. Another option is to configure Mac OS to output backslash, but then you can't input ¥.
When coding with an ASCII keyboard, I frequently make typos due to muscle memory. If you work in the US, that is another major disadvantage. Your work computers will have ASCII keyboards, not JIS keyboards.
Do you actually have to wait for the modal to show up? I was under the impression you could just press ctrl + shift and not wait for the modal and it would still switch layouts, but I could be misremembering.
Regarding muscle memory: That hasn’t been a problem for me as much as some shortcuts just not working.
Some applications seem to insist on controlling these by key codes, but display them as characters mapped to a US ANSI layout, giving me no way to actually configure the one I want for those keys that are physically different between ANSI and ISO.
10% of the remaining advantage of Scheme today is not needing to use the Shift key to type identifiers on US keyboards. Instead, you use minus rather than underscore, and there's no camel-case, and mostly no all-caps (except for syntax transformer pattern variables, IMHO).
However, Scheme and other Lisps have the problem of parentheses being a shifted character on most US keyboards.
For Scheme, my Emacs tweaks included letting you type the square brackets (unshifted on US keyboard) to get parentheses. (Or you'd get the correctly matching closing character, if the close-square-bracket key you pressed would match an open-square-bracket.)
One of my favorite keyboard layout tweaks is being able to tap left/right shift for open/close parens. How well it works depends on the keyboard but especially on split keyboards it can be very nice.
I guess you're being downvoted because of how you said it, but you're not wrong. I have a Japanese keyboard too, albeit not a Mac one, and the underscore needs shift (without shift, it's backslash, which means that yes, I don't need to use M-¥). Caps lock is also under tab, and Control on the bottom left.
For multiple lexies into a single identifier, I love middle dot (·), which is actually works in most modern languages out of the box. Example `some·variable`. Try it in your favorite languages and let me now how it goes.
For elements that have to bee ditched in a destructuring operation, like `target, _ = some·generator()`, it’s possible to use a word that explicit this discard. One short one term for that is "lee", as in "Basest part, ‘dregs’, ‘refuse’[1]."
I wasn’t aware that many people disliked so much underscore and other YOLO approaches to morphe agglutination. I always felt sad that we had to endure this ridiculous typographical masochism that plague the whole industry. But going against a widespread habit, as absurd and sore could it be, is generally its own road to some form flagellation.
In Clojure '-' is not a special symbol, so it's used as a word separator in function names, like 'get-in'. That's possible because '-' is not an operator, but is a function with a 1-symbol name.
The downsides aren't unique to Japanese keyboards. On Danish keyboard " requires the use of the shift key, same for = and the \ in on the 7 keys, along with /, requiring you to hit option + shift + 7 (on a mac keyboard, I believe it's Alt + shift + < on none Apple keyboards).
The Japanese keyboard in the article does have { printed on a key, it's Option + Shift + 8 and the Danish Mac keyboard, and the key isn't labels with {, } is on the 9.
I briefly flirted with a Japanese keyboard just to get the extra keys that they have (next to the space bar which is much smaller) I then remapped those keys to other more useful commands.
I then discovered VIA/QMK keyboards and now I have keycaps I can't even see on my vertically mounted split-key keyboard and more programmability than I know what to do with. But in 2012, a Japanese Keyboard was much cheaper than a Kinesis and to me the only option.
Food for thought. When I was making my own custom keyboard layout I resisted the additional rabbit hole of shuffling punctuation. The only change I did make was to put ',' above right-hand pinky (shifted is ':' and home-row pinky being a letter). I decided I'm not going to use semi-colon terminated programming languages anymore so it's fine to be down with the '<' key.
I used one for 10-15 years, and the extra column of characters definitely were bad for RSI. My right ring finger’s tendon was impacted the most. The extra reach to arrows, the enter key, etc. were too much for me. I went back to a US layout and don’t have issues now.
Sounds like a questionable tradeoff to me. I just want underscore remapped to shift-space. It’d be easy to type because they’re both big keys. And underscore is a variation of a space anyway. It’s like an uppercase space
> less drastic than switching to something like Dvorak
Still no regrets. With software being such an important thing to my life, easy snake_case & kebab-case a big reason I haven’t been interested in switching to another layout.
Similar thing. To avoid my fingers fighting each other when pressing cut copy paste in Macbook, I almost bought those 20-key left hand gaming keyboard so that I can do them in a single keystroke.
I think underscores are pretty painless, but maybe it's just that my hands being like Trumps tiny hands make it less painful? I never liked the idea of a short space bar, but thinking about it now with the comment of having a couple useful buttons does sound kinda nice.
kleiba|1 year ago
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.
karmakaze|1 year ago
[0] https://software.sil.org/ukelele/
[1] https://www.microsoft.com/en-us/download/details.aspx?id=102...
3836293648|1 year ago
deathanatos|1 year ago
seritools|1 year ago
kazinator|1 year ago
"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/
nomel|1 year ago
bowsamic|1 year ago
red_hare|1 year ago
I believe this is an artifact of JIS_X0201, which is, to my knowledge, the first major Japanese 8-bit encoding and mostly 7-bit ASCII + Katakana (that character set you see in old Japanese video games) and some Japan-specific symbols filling the other half of the 8-bit space.
In it, byte 0x23 was changed from "\" to "¥".
The history is fascinating:
> The 1964 ISO draft reserved the positions 0x24 and 0x5c for first and second currency symbols to be assigned by each country, but it was considered too dangerous in international communications to use currency symbols that could be localized. The ISO committee had two options that to use a generic currency symbol (¤) or to give the dollar ($) and pound (£) signs permanent assignments. It was agreed that the dollar sign was assigned to position 0x24 and the pound sign was to position 0x23. The latter was not required in countries that did not need the pound sign. The JIS committee decided to put the yen sign (¥) in 0x5c (one of the national use positions).
https://en.wikipedia.org/wiki/JIS_X_0201
It's legacy lived on in Shift JIS which Window's extended and resulted in Japanese Windows computers having file paths like "C:¥Users¥MyName" and escape sequences like "¥n"
All this to say, my respect for Japanese devs who work with encoding is top-tier.
gramie|1 year ago
C:¥Program Files¥Microsoft¥Office¥word.exe
ammo1662|1 year ago
dylan604|1 year ago
wk_end|1 year ago
kazinator|1 year ago
My technique is efficient in circumstances where I have to type several upper case letters in a row, which happens quite regularly in C programming. Using "proper" shifting for an identifier like UINT_MAX is nonstarter, and using CapsLock before and after is likewise inefficient.
I think the double Shift key design and the related proper technique is a holdover from mechanical typewriters. You need to put a good amount of strength into the shift. It's not as easy to type with your left hand while its pinky is anchored to the Shift key.
kleiba|1 year ago
https://news.ycombinator.com/item?id=3976669#3981000
(Don't click, it's not worth reading. Pretty much like this comment, too, sorry.)
koito17|1 year ago
I will admit, JIS layout makes writing Clojure a bit easier, though it also makes quoting tedious. Escaping is even more tedious. Push M-¥ is one option. Another option is to configure Mac OS to output backslash, but then you can't input ¥.
When coding with an ASCII keyboard, I frequently make typos due to muscle memory. If you work in the US, that is another major disadvantage. Your work computers will have ASCII keyboards, not JIS keyboards.
lxgr|1 year ago
Regarding muscle memory: That hasn’t been a problem for me as much as some shortcuts just not working.
Some applications seem to insist on controlling these by key codes, but display them as characters mapped to a US ANSI layout, giving me no way to actually configure the one I want for those keys that are physically different between ANSI and ISO.
fragmede|1 year ago
neilv|1 year ago
However, Scheme and other Lisps have the problem of parentheses being a shifted character on most US keyboards.
For Scheme, my Emacs tweaks included letting you type the square brackets (unshifted on US keyboard) to get parentheses. (Or you'd get the correctly matching closing character, if the close-square-bracket key you pressed would match an open-square-bracket.)
dunham|1 year ago
The file is at https://www-cs-faculty.stanford.edu/~knuth/programs/DonKeys...., linked from https://www-cs-faculty.stanford.edu/~knuth/programs.html
ryukafalz|1 year ago
chuckadams|1 year ago
mgaunard|1 year ago
Apple messes with the standard keyboard of all layouts.
glandium|1 year ago
psychoslave|1 year ago
For elements that have to bee ditched in a destructuring operation, like `target, _ = some·generator()`, it’s possible to use a word that explicit this discard. One short one term for that is "lee", as in "Basest part, ‘dregs’, ‘refuse’[1]."
I wasn’t aware that many people disliked so much underscore and other YOLO approaches to morphe agglutination. I always felt sad that we had to endure this ridiculous typographical masochism that plague the whole industry. But going against a widespread habit, as absurd and sore could it be, is generally its own road to some form flagellation.
[1] https://www.oed.com/dictionary/lee_n2?tab=meaning_and_use#39...
sesm|1 year ago
gfy009|1 year ago
simonebrunozzi|1 year ago
No surprise, as Ruby was developed by a Japanese. [0]
[0]: https://en.wikipedia.org/wiki/Ruby_(programming_language)
lawn|1 year ago
Yes, I have underscore on the main layer on a 32-key keyboard. It's just that common in my usage.
mrweasel|1 year ago
The Japanese keyboard in the article does have { printed on a key, it's Option + Shift + 8 and the Danish Mac keyboard, and the key isn't labels with {, } is on the 9.
kleiba|1 year ago
Just kidding, I know that some people have a hard time typing them, especially when your day job consists of doing exactly that for eight hours.
zwayhowder|1 year ago
I then discovered VIA/QMK keyboards and now I have keycaps I can't even see on my vertically mounted split-key keyboard and more programmability than I know what to do with. But in 2012, a Japanese Keyboard was much cheaper than a Kinesis and to me the only option.
karmakaze|1 year ago
dang|1 year ago
Underscores are stupid? Get a Japanese keyboard - https://news.ycombinator.com/item?id=3980866 - May 2012 (40 comments)
Underscores are stupid - https://news.ycombinator.com/item?id=3976669 - May 2012 (127 comments)
jacquesl|1 year ago
omitmyname|1 year ago
jessetemp|1 year ago
toastal|1 year ago
Still no regrets. With software being such an important thing to my life, easy snake_case & kebab-case a big reason I haven’t been interested in switching to another layout.
akasakahakada|1 year ago
amelius|1 year ago
On my keyboard, the symbol for underscore looks just the same as the symbol for minus. No idea which is underscore and which is minus.
unknown|1 year ago
[deleted]
lfkdev|1 year ago
wormius|1 year ago
I think underscores are pretty painless, but maybe it's just that my hands being like Trumps tiny hands make it less painful? I never liked the idea of a short space bar, but thinking about it now with the comment of having a couple useful buttons does sound kinda nice.
nbzso|1 year ago
unknown|1 year ago
[deleted]
unknown|1 year ago
[deleted]
bamboozled|1 year ago