Search code examples
iterm2

Disable / Changing default keyboard shortcuts in iTerm2


I know I can add key shortcuts to a profile or in general to iTerm2

But can I, and if so, how do I disable or change the default application keyboard shortcuts in iTerm2?

For example, I'd like to disable the command ⌘ W for Closing the current pane / window.

enter image description here


Solution

  • This can be done in 2 ways.

    Using defaults command:

    1. Run defaults write com.googlecode.iterm2.plist NSUserKeyEquivalents -dict-add "Close" "\U0000". (\U0000 means NULL)
    2. Restart iTerm2.

    To revert this run, defaults write com.googlecode.iterm2.plist NSUserKeyEquivalents -dict-add "Close" -string "@W"

    Using System Preferences: (In this method, shortcut is changed, not removed.)

    1. Go to Preferences -> Keyboard -> Shortcuts -> App Shortcuts.
    2. Click + icon
    3. In the popup, select Application as iTerm, Menu title as "Close" (exactly as in the iTerm menu) and set the needed shortcut.