Disable Command-W in the terminal
Is there any way to disable Command+W in the terminal?
On several occasions I have accidentally closed a terminal window containing important information when I meant to close a Safari tab and did not realize that the terminal was the active window.
To disable ⌘W in Terminal, do the following:
From the menu in the top left corner of the screen, select System Preferences. Click on Keyboard then Keyboard Shortcuts then Application Shortcuts.
Click the + button to add a new shortcut
Select "Terminal.app" for the application, and for the command, type
Close Window
(this is case sensitive). In the shortcut box, give it a different shortcut, like ⌘ControlWNow ⌘W will not close your terminal windows.
You can set a prompt before closing in the preferences:
Terminal Preferences → Settings → Shell