Today I learned a neat tip for OS X. It is a solution for a problem that I run into on occasion. This is not a problem that I see frequently, and I happen to have other ways that make this issue not such a big deal to me. The problem is when you are in Google Chrome or in iTerm 2 and you mistakenly press
Cmd-q which will exit the program when you meant to press
Cmd-w to close a single tab. I do this from time to time, but it has never really bothered me enough to do anything about it.
The reason this has not bothered me is that I use
Google Chrome almost exclusively and if I mistakenly close it I can reopen it and press
Cmd-Shift-t to reopen all of my most recent tabs. That trick usually keeps me out of trouble when I mistakenly exit
Google Chrome. In
iTerm I am constantly running
Tmux. When I mistakenly close
iTerm I can reopen it and reattach to my
Tmux session and it will be as if I had never closed anything.
I have mitigated the risk of mistakenly closing and losing everything by using
Tmux, however it is still a slight annoyance to have to open up
iTerm after having fat fingered something (Even thought Alfred makes opening applications fairly quick).
To prevent this issue all together @northben taught me this neat little trick. Open the
Keyboard preferences, click on the
Shortcuts tab then on
App Shortcuts on the left. Then click the
+ button to add a new shortcut. You will then be prompted by a dialog box where you can choose the target application that you want to change and enter which command you would like to override. Make sure you enter the exact text shown for the shortcut that you are overriding. For example, in
Google Chrome the text for the shortcut is
Quit Google Chrome. Here is where you would find the text to enter:
Then it is just a matter of coming up with what you want the new shortcut to be that you will be unlikely to ever accidentally press. In my case I used the following shortcut:
⌃ ⌥ ⇧ ⌘ =
Here is a walk through of overriding