# 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?](https://www.corsair.com/us/en/explorer/gamer/keyboards/ansi-vs-iso-whats-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

![](/files/epgWtF8bgfgPQICIdPpg)

### Use XWin Keymap

Download the XWin Keymap and use it.

![](/files/TtaPeGKglTelZf84YPs0)

![](/files/0NQuUVIHWRNAweMXW9pt)

### Cancel the Swap of Keys for Intellij IDEA Only

[Karabiner-Elements](https://github.com/pqrs-org/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.

![](/files/vsZM83brwQ3FXtY5Hbnc)

![](/files/0SzAb8ey82oNTNdvxbve)

![](/files/yudLrX4in5Jz9u0CWqcK)

### Update the Keymap in VMWare

![](/files/2Zvzc6f1N4BsxnFDjgvi)

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

![](/files/PagjfKKNdu3kVpBs0sX7)

### 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](https://github.com/samvtran/jetbrains-macos-keybindings-for-all#key-updates) to use macOS keymap for windows or linux.

## Reference

* [Intellij Default windows keymap on Mac OS X](https://stackoverflow.com/questions/35874608/intellij-default-windows-keymap-on-mac-os-x)
* [Essential IntelliJ IDEA keyboard shortcuts](https://ruleoftech.com/2015/essential-intellij-idea-keyboard-shortcuts)
* [How to use Windows keymap on Mac and in your favorite IDE for example IntelliJ?](https://viktorreinok.medium.com/how-to-use-win-hotkeys-on-mac-and-in-your-favorite-ide-for-example-intellij-c125da1fd1f1)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.damonyuan.com/tech/2024/241102-windows-keymap.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
