When using a Mac with a JIS keyboard that I bought a long time ago, I can't help but notice the US keyboard enthusiasts around me. They often say, "For development, it's got to be a US keyboard!" Even when I try to explain, "Well, the Kana key and the Control key placement are better," I still feel a bit hurt inside. I'm sure you've experienced something similar.
Here's a simple way to try a US-style layout with a JIS keyboard.
Thanks to an amazing app called Karabiner (formerly known as KeyRemap4MacBook), it's easy to experiment.
Check the option "Use Japanese Keyboard as US Keyboard".
That's it. You're done. From the moment you check it, the key layout will change to a US style. The backquote key is mapped to the ¥ key position.
Additionally, there's a similar mode called Semi-US Keyboard mode, where only the semicolon, colon, and quote keys are in the US style. Once you get used to it, it makes coding easier.
The JIS keyboard has more keys than the US keyboard, so with "Use Japanese Keyboard as US Keyboard," there are some redundant keys.
The ¥ key and the underscore key on the JIS keyboard are both mapped to the backquote key, which feels a bit wasteful.
Although you can input an underscore by pressing "Shift" + "-", since there's a dedicated underscore key, and it's used frequently, let's set it up so that pressing that key inputs an underscore directly.
Click on Open private.xml in Karabiner and edit the private.xml file like this:
<?xml version="1.0"?> <root> <item> <name>Use Japanese Keyboard as US Keyboard (without Underscore)</name> <identifier>remap.private_jis_jansi_without_underscore</identifier> <autogen>__SetKeyboardType__ KeyboardType::MACBOOK</autogen> <autogen>__KeyToKey__ KeyCode::JIS_YEN, KeyCode::BACKQUOTE</autogen> <autogen>__KeyToKey__ KeyCode::JIS_UNDERSCORE, KeyCode::MINUS, MODIFIERFLAG_EITHER_LEFT_OR_RIGHT_SHIFT</autogen> </item> </root>
The preset "Use Japanese Keyboard as US Keyboard" is written in Resources/include/checkbox/languages/japanese/keyboard_layouts.xml. By referring to that, we’re modifying it so that pressing the underscore key switches to "Shift" + "-".
After saving the private.xml, click the Reload XML button in the Change Key tab in Karabiner.
Then, the newly saved "Use Japanese Keyboard as US Keyboard (without Underscore)" will appear at the top. Check the checkbox to apply it.
Comments