Disable Ctrl-H, Ctrl-P, and other Mac keyboard shortcuts

keybindingsshortcut

On GUIs with editable text focused on Mac I cannot seem to remap ctrlP and ctrlH to shortcuts I want.

In IntelliJ I am trying to map my VIM ctrl shortcuts (ctrlH next tab, ctrlP open file). When I hit ctrlP I see that the "Navigate" tab highlights and the File… option is selected, but its function is overridden by moving up in the currently focused text edit window. The same problem is present with ctrlH and trying to switch to the previous tab.

Any thoughts?

BTW, it's the same with ctrlN and any other native text editing commands. They also do not exist in System Preferences > Keyboard anywhere.

Best Answer

OS X uses Emacs-like keybindings in most text editing windows. Normally you would change them to another text editing function but I don't know about functions like next tab or open a file. Those would be mapped in the System Preferences > Keyboard > Shortcuts window from a key to a menu in the IntelliJ app.

But, if it can accept the Emacs keybindings for other functions, try customizing it yourself. Edit the ~/Library/KeyBindings/DefaultKeyBinding.dict file (creating the KeyBindings folder and the dict file if they don't exist) with something like this.

{ "~d" = "deleteWordForward:"; "^w" = "deleteWordBackward:";

Save/exit then quit/restart the IntelliJ app (you don't need a reboot) and see if Option-d deletes the next word and Control-w deletes previous word. If it works, research the Emacs bindings for next tab and open file.

Good luck!