23

I'm

  • running IntelliJ 14
  • using Mac OS X layout
  • running on OS X (Yosemite)

IntelliJ is using DVORAK in general but not for keyboard shortcuts. keyboard shortcuts are in QWERTY. As if they were scancode based instead of the key value after mapping.

Ideas?

edit 1 @gabriel hard to tell but here are some examples... note: m, a and 0-9 are same on DVORAK and QWERTY

cmd+/     'comment line' flashes code menu and sometimes moves to a brace (/ == {)
cmd+b      works, goes to definition  (b == n)
cmd+opt+l 'reformat' flashes code menu  (l == p)
John Dhom
  • 1,022
  • 9
  • 21
  • Can you give us an example? For example, what actually happens if you press `command` + `O`? And what would you expect to happen? – GabrielOshiro May 29 '15 at 20:10
  • Always send a comment with @ so it will bump up the question. I did not see your edit ;-) So, your Keyboard is originally QUERTY? and you configured it to be DVORAK using MacOS `System Preferences`? – GabrielOshiro Jun 07 '15 at 14:42
  • @GabrielOshiro yes. Same/similar result on MS Natural keyboard, built-in and apple bluetooth keyboard. Is frustrating to not have all shortcuts working. Pondering next step(s). – John Dhom Jun 08 '15 at 16:22
  • Hurrah! I have found someone else with exactly the same problem! My keyboard is configured as Dvorak under OSX 10.10.3 (early 2015 Retina MacBook Pro). When I type normally, everything is OK, but some shortcuts do what their Qwerty counterparts would, for example: When I press option-/ IntelliJ does "navigate back" instead of "comment line". In Dvorak, the key which normally is [ is mapped to /, so it does look like IntelliJ is reading the QWERTY value of the key. Interestingly, the letter keys DO seem to work. HELP! – Charl Botha Jun 29 '15 at 14:38

4 Answers4

22

It turns out this is a problem in Java that has existed for some years, and is still present in Java 9. See the bug report here: https://bugs.openjdk.java.net/browse/JDK-8022079

JetBrains has been aware of the problem for some years, but is waiting for Oracle to fix it. See these JetBrains bug reports: https://youtrack.jetbrains.com/issue/IDEABKL-6493 and https://youtrack.jetbrains.com/issue/IDEA-63779

In those reports you'll find a work-around using a free tool called Karabiner. I have just verified that it works for IntelliJ. It will probably also work for other Java-based tools.

For OSX earlier than Sierra The work-around is:

  • Download and install Karabiner from https://pqrs.org/osx/karabiner/
  • In the OSX System Preferences, set your keyboard to the default "U.S. International" PC. If you don't often type diacritics and other international characters, it's easier to just set the keyboard to "U.S" instead.
  • In the Karabiner settings, type "dvorak" in the search box, then scroll down to the section For U.S. Input Source and check Use Dvorak Keyboard Layout (QWERTY to Dvorak)

From macOS Sierra onwards, as reported by user MithrilTuxedo in the comments, the procedure is different. You have to use Karabiner Elements (the new Karabiner core) with a configuration file. I have outlined the procedure at https://cpbotha.net/2016/12/16/dvorak-remapping-with-karabiner-elements-on-macos-sierra-works/ and summarise it here briefly:

  • Download and install Karabiner Elements.
  • Copy qwerty_to_dvorak.json from the examples and install it as the new karabiner.json configuration file.
  • If Karabiner Elements is running, it'll pick up the new file.

This bug will affect most Java-based tools such as those by JetBrains (IntelliJ, PyCharm, WebStorm, AppCode) and probably also Netbeans. The work-around summarised above should alleviate the problem in all cases.

Lime
  • 13,400
  • 11
  • 56
  • 88
Charl Botha
  • 4,373
  • 34
  • 53
  • Thanks for this! Works perfectly on my mac. – wim Apr 07 '16 at 03:35
  • This doesn't solve the issue. Actually had no effect. – swade May 10 '16 at 14:52
  • I have many confirmed positives. Maybe you are dealing with a different problem, or it is the same problem but you have not applied this fix correctly? – Charl Botha May 10 '16 at 15:18
  • For 10.12 (Sierra) you'll need to use https://github.com/tekezo/Karabiner-Elements – MithrilTuxedo Oct 08 '16 at 01:03
  • 1
    Oh, and at the moment Karabiner-Elements has no real GUI, but instead describes how to set the config file. In the repo examples/qwerty_to_dvorak.json does the trick. It'll start working as soon as you save your config. – MithrilTuxedo Oct 08 '16 at 01:21
  • The Sierra instructions skip the part where you have to use U.S. keyboard layout in OS X preferences. I didn't read the pre-sierra instructions initially because I didn't think they applied to me. I also don't love this as a solution. IntelliJ forcing me to use a key mapper for everything doesn't seem like the right way to solve this. In the past I re-mapped shortcuts in IntelliJ but lost that config. This does work. And is certainly "easier" than re-mapping all the keys in IntelliJ keymap config. – Derrek Mar 13 '17 at 18:52
  • El Capitan users: 1. Install standard Karabiner 2. Open System Preferences>Keyboards>Import Sources>Revert back to US 3. Open Karabiner, select "Use Dvorak Keyboard Layout (QWERTY to Dvorak)" – A. Weatherwax Mar 17 '17 at 19:43
  • I don't really like the "It's Java's fault and all Java Applications are affected" answer. I have both PHPStorm and NetBeans on my system. Keyboard shortcuts are fine in NetBeans, but messed up in PHPStorm. – seismicmike Jun 07 '17 at 18:19
  • Update: I followed the Karabiner Elements instructions, and they are not sufficient. Whereas before I had the DVORAK - QWERTY Command keyboard working with DVORAK typing and QWERTY keyboard shortcuts in everything EXCEPT PHPStorm, now I have just a DVORAK layout with no QWERTY shortcuts anywhere... – seismicmike Jun 07 '17 at 18:36
  • The goal of this answer is to have Dvorak layout with Dvorak shortcuts everywhere, NO qwerty in sight. What exactly are you seeing, and what are you expecting? – Charl Botha Jun 09 '17 at 12:51
15

I've had a similar problem using key combinations like ctrl+n in intellij 16 on linux (red hat). I use Colemak keyboard. I had two input sources setup in my operating system, system preferences .

  1. English(US)

  2. English(Colemak)

When I changed the order of the Input Sources, and put Colemak first, the problem seemed to go away.

System Tools > Settings > Keyboard > Input Sources

Mz A
  • 889
  • 11
  • 10
2

JetBrains are waiting for the bug to be fixed upstream in JDK, which of course will never happen. The other answer here is informative, but will only work on Mac OS, so if you're on linux or windows you're out of luck there.

I wrote a script to work around the issue, which you can find here. If you normally use GNOME keymap in pycharm on linux, then you're in luck - you can simply import my dvorak_settings.jar file and get back to coding.

Otherwise you can use the script to generate your own bugfixed keymap, read on...

The original keymap files are located in <pycharm>/lib/resources.jar/idea/Keymap_*.xml.

Example usage:

./to_dvorak Keymap_Emacs.xml -o Keymap_Emacs_Dvorak.xml

Have a browse over the generated file and if it looks sane, pack it up into the .jar file (see my dvorak_settings.jar example for the required structure) and import this in your IDE.

Community
  • 1
  • 1
wim
  • 338,267
  • 99
  • 616
  • 750
0

This problem is (finally!) fixed in IntelliJ IDEA 2017.1. See JetBrains issue JRE-172, “Wrong keys are picked up on dvorak layout in Mac OSX 10.6.2”.

It also seems to be fixed in other JetBrains tools. I tested that it's fixed in PyCharm 2017.1, CLion 2017.1, and AppCode 2017.1.

rob mayoff
  • 375,296
  • 67
  • 796
  • 848
  • 1
    fyi... just setup a new machine with intellij 2017.1.1... the shortcut mapper dialog still doesn't respect dvorak on osx. – John Dhom Apr 21 '17 at 14:14