⌘ + W closes the current window on macOS Catalina. This conflicts with my muscle memory of using M-w in Emacs.
I looked at Disable Command-W in the terminal, but the accepted answer does not work on macOS Catalina.
How do you disable ⌘ + W?
Ask Different is a question and answer site for power users of Apple hardware and software. It only takes a minute to sign up.Sign up to join this community
Like in old versions, it be can't removed. The work around is the same: the system default can be overridden to a new key combination. The hotkey must be associated with a context menu item name (ie. an app specific menu item). The name must match exactly.
Systems apps use the name
Close to mean close window, along with iTerm2. Some other apps use the more verbose
Close Window. Remap both to get decent app coverage. Note that some apps may use other unique names that mean close window. Separate entries will have to be made for these apps to remap it globally.
System Preferences ->
Shortcuts tab, then
App Shortcuts in the left pane.
+ at the bottom of the window to add a new shortcut.
To remap it globally, select
All Applications in the
Application field. To change Cmd-w on a specific application instead of globally, select that instead.
Menu Title to
Close. It is case sensitive and must match exactly.
Keyboard Shortcut to the desired key combination. I set it to an obscure value so it's essentially 'disabled'.
Add to finalize the key shortcut. The right pane should now show a new entry for
Close with your key combination (see the first image for an example).
Add another hotkey entry with
Application set to
All Applications and
Menu Title set to
Close Window for additional coverage.
Close the menu.
The change takes effect immediately, including with open apps.