21

Is it possible to have the default windows key map for Intellij IDEA on Mac OS X. It is not an option like the Eclipse Windows Key Map?

perkss
  • 1,037
  • 1
  • 11
  • 37

3 Answers3

26

That was a pain for me aswell. Iam working at sometimes at IntelliJ in windows, linux and macOS and just don't want to handle the different layouts mentally.

Ive finally succeeded at having the same layout and I also swapped the control/command buttons on the keyboard (i am using a regular windows keyboard) in all applications except IntelliJ so I can use ctrl + c/v/a/f/... through the whole system.

  1. changed the keymap in IntelliJ to "Default for XWin"
  2. installed karabiner-elements which allows any keyboard/mouse changes: https://github.com/tekezo/Karabiner-Elements
  3. edited my /Users/username/.config/karabiner/karabiner.json and added my own rule in that json under profiles > complex_modifications > rules:

    {
      "description": "ctrl/command swap",
      "manipulators": [
        {
          "conditions": [
            {
              "bundle_identifiers": [
                "^com\\.jetbrains\\.intellij$"
              ],
              "type": "frontmost_application_unless"
            }
          ],
          "from": {
            "key_code": "left_control"
          },
          "to": [
            {
              "key_code": "left_command"
            }
          ],
          "type": "basic"
        },
        {
          "conditions": [
            {
              "bundle_identifiers": [
                "^com\\.jetbrains\\.intellij$"
              ],
              "type": "frontmost_application_unless"
            }
          ],
          "from": {
            "key_code": "left_command"
          },
          "to": [
            {
              "key_code": "left_control"
            }
          ],
          "type": "basic"
        }
      ]
    }
    
Mariusz
  • 448
  • 6
  • 8
  • Thx for above solution, I added switch Fn and left Control for internal keyboard only. Now all keys are where they should be ;-) – Martin Kalina Nov 05 '20 at 08:35
  • In case one would like to use a Windows keymap and the same keys across platforms... one would need to modify the XWin file (keymap idea plugin) and there replace all the control instraces with meta. YOu can find the file in the IDE setting repo at: /Users/username/Library/Application Support/JetBrains/IntelliJIdea2021.1/settingsRepository/repository/keymaps – Viktor Reinok Jun 06 '21 at 18:12
  • I wrote a blog post about setting up the keymap. https://viktorreinok.medium.com/how-to-use-win-hotkeys-on-mac-and-in-your-favorite-ide-for-example-intellij-c125da1fd1f1 – Viktor Reinok Jul 11 '21 at 06:54
  • 2
    wow this is still relevant in 2021! I don't understand why it should be `frontmost_application_unless` I thought it should be `frontmost_application_if` - because I read the setting as `Update the key binding *if* the front most application is intellij` and not `Update the key binding *unless* the front most application is intellij` ... am I missing something? – vivekmore Aug 02 '21 at 18:45
1

yes, it is possible. go to Preferences -> keymap -> keymaps, and select your default

enter image description here

Ofer Segev
  • 5,094
  • 2
  • 22
  • 22
  • 2
    That is still different to windows though, but will have to be sufficient it seems. I wanted to use the exact key map they use on Windows on a Mac ie us of Ctrl instead of CMD. – perkss Apr 06 '16 at 18:44
  • 1
    @Matt for me, when i was selecting `XWin`, the keymap was windows and also the Ctrl key was used not cmd. However, I'd prefer to use Cmd, how did you get that to work? :) – bersling Nov 07 '17 at 06:45
  • @bersling I do not think it is possible at the moment – perkss Feb 03 '18 at 07:01
0

Adding to Mariusz' answer, which is working for QWERTY keyboards, if you want to do that setup with a QWERTZ keyboard and are struggling how to type {}, [] and \:

Go to IntelliJ -> Settings -> Keymap -> Tool Windows and remove (or remap) the shortcuts for Debug, Problems, Services, Structure and Git. You need to replace them, otherwise they will overwrite the mapped bindings for the listed symbols.

neza
  • 124
  • 12