TL;DR: This doesn't seem possible with the way both editors handle their keybindings.
I tested this using AppCode 2019.2 and Xcode 10. I first tried to find where the two IDEs keep their keymap files on disk.
Xcode keeps its keymap files in Library ▸ Developer ▸ Xcode ▸ UserData ▸ KeyBindings
and as a .idekeybindings
file. Opening it up in TextEdit revealed it's a plist-formatted file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
</plist>
I was a little surprised to find it empty, but decided to try and manually trigger an update by setting a custom keybinding. Opening the file again reveals that Xcode only stores the diff of keybindings:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Menu Key Bindings</key>
<dict>
<key>Key Bindings</key>
<array>
<dict>
<key>Action</key>
<string>orderFrontAboutPanel:</string>
<key>Alternate</key>
<string>NO</string>
<key>CommandID</key>
<string>Xcode.IDEKit.CmdDefinition.AboutXcode</string>
<key>Group</key>
<string>Xcode Menu</string>
<key>GroupID</key>
<string>Xcode.IDEKit.MenuDefinition.Main</string>
<key>GroupedAlternate</key>
<string>NO</string>
<key>Keyboard Shortcut</key>
<string>~`</string>
<key>Navigation</key>
<string>NO</string>
<key>Title</key>
<string>About Xcode</string>
</dict>
</array>
<key>Version</key>
<integer>3</integer>
</dict>
</dict>
</plist>
So, theoretically, if we just got the keybindings from Intellij, and formatted them to be like the Xcode ones, it should be no problem
Then we turn to the Intellij platform. Luckily, I didn't have to do much hunting for these key files, because Intellij already documented them.
Keymaps for Intellij are located under ~/Library/Preferences/IntelliJIdea2019.2/keymaps
. In my case (using AppCode), it was under ~/Library/Preferences/AppCode2019.2/jba_config/mac.keymaps/
To my surprise, it was also empty. Trying to set a manual keybind resulted in similar behavior to what I saw in Xcode:
<keymap version="1" name="Default for macOS copy" parent="Mac OS X 10.5+">
<action id="EditorBackwardParagraph">
<keyboard-shortcut first-keystroke="shift ctrl meta alt back_quote" />
</action>
</keymap>
Unfortunately this was also confirmed by the same doc as linked above, which states:
Each keymap file contains only the differences relative to the parent keymap.
So, unless you have every single keybinding as custom, there is currently no way to export keybindings from one to another. Sure, you can do it manually, but as you said that's counterproductive.