Using Windows Keymap in Mac and Intellij

Finally, the day comes as I don't want to remember two sets of hotkeys of Intellij IDEA in MacOS and Windows while using a Windows Keyboard.

The target is to swap the control/command buttons on the keyboard in all applications except IntelliJ so I can use ctrl + c/v/a/f/... through the whole system.

Before starting, better to check which type of the Windows keyboard you have - ANSI vs ISO: What’s the best keyboard layout?

Swap the Control and Command Key

Because the difference in the layout of Windows Keyboard and Mac Keyboard, we need to swap the Control and Command key.

Use the Standard Function Key

Use XWin Keymap

Download the XWin Keymap and use it.

Cancel the Swap of Keys for Intellij IDEA Only

Karabiner-Elements is used here.

Swapped the control/command buttons on the keyboard in all applications except IntelliJ so I can use ctrl + c/v/a/f/... through the whole system.

{
    "description": "control/command swap",
    "manipulators": [
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com\\.jetbrains.+"
                    ],
                    "type": "frontmost_application_unless"
                }
            ],
            "from": { "key_code": "left_control" },
            "to": [{ "key_code": "left_command" }],
            "type": "basic"
        },
        {
            "conditions": [
                {
                    "bundle_identifiers": [
                        "^com\\.jetbrains.+"
                    ],
                    "type": "frontmost_application_unless"
                }
            ],
            "from": { "key_code": "left_command" },
            "to": [{ "key_code": "left_control" }],
            "type": "basic"
        }
    ]
}

Note that using this configuration all the JetBrains products' keymap will be updated.

Disable CTRL + → and CTRL + ← Switches Desktops

Go to System Preferences > Keyboard > Shortcuts > Mission Control and change the settings for "Move left a space" and "Move right a space" or disable them completely.

So that the experience when coding in Intellij will be the same as moving between words.

Disable Some macOS Shortcuts

There may have some conflicts between the XWin keymap and macOS keymap.

Update the Keymap in VMWare

If your VMWare window flickers randomly, try the following configuration,

Update XWin Keymap in macOs

  • Map the Insert to your keyboard (on my keyboard the Insert key is mapped to Help in Intellij, not sure if it's the same to others...),

    1. New...

    2. Generate...

TO BE CONTINUED

I will check if other settings need to be updated to keep the experience aligned between coding in Windows and coding in macOS, stay tuned.

Another option: macOS for all to use macOS keymap for windows or linux.

Reference

Last updated

Was this helpful?