BetterTouchTool is no longer free.
I reached this page because I wanted to disable command-h (hide application) which is not shown in System Preferences. This is my solution.
BetterTouchTool is a utility which can disable keyboard shortcuts (and has many other uses). http://www.boastr.de/
To disable command-w globally
- Install BetterTouchTool
- Click on the BetterTouchTool menubar item and choose "Preferences"
- Click "Gestures"
- Click "Keyboard"
- Click "Global"
- Click "Add New Shortcut"
- Click "Keyboard Shortcut"
- Type the shortcut you want to disable (for example, command-w)
- Set Trigger Predefined Action to "No Action" (which is the default)
Note that you can also set a keyboard shortcut for a specific application.
To disable command-w only for Terminal
- Install BetterTouchTool
- Click on the BetterTouchTool menubar item and choose "Preferences"
- Click "Gestures"
- Click "Keyboard"
- Click the plus sign at the bottom of the "Select Application" pane
- Choose Terminal (in Applications/Utilities folder)
- Click "Add New Shortcut"
- Click "Keyboard Shortcut"
- Type the shortcut you want to disable (for example, command-w)
- Set Trigger Predefined Action to "No Action" (which is the default)