How to make ⌘⌫ delete a line of text in Messages?
The shortcut ⌘+⌫ normally deletes a line of text in a text field. But in the new Messages app in Mountain Lion, this is the shortcut for "Close Conversation…" (or, if you choose "Save history when conversations are closed" in the preferences, it's "Delete Conversation…").
Is there a way to disable this shortcut such that ⌘+⌫ can again be used for deleting text?
You can change the shortcut for "Close Conversation" to something else, that should avoid the conflict. To do this, open Keyboard Preferences, and then go to the "Keyboard Shortcuts" tab. Click Application Shortcuts, then the + button to add a new one. You should get a popup like this one (I'm still on Lion, but I don't believe they changed much):
Change the application to Messages, enter the proper menu title (if it uses an ellipsis, you may have to enter that exact character — not just three periods — by hitting optionshift;), then enter in a shortcut you're unlikely to use.
It's also possible to disable a keyboard shortcut from the command line, rather than just setting it to some obscure command. However I haven't tested this on Mountain Lion or Messages app, so no guarantees.
If you're comfortable with the command line, the proper command would likely be defaults write com.apple.Messages NSUserKeyEquivalents -dict-add "Close Conversation…" nil
. However I don't have access to Mountain Lion, so the com.apple.Messages part is just a guess. You may want to test first by trying defaults read com.apple.Messages
and see if it pops up with an error. It should spit out a long list of plist-formatted preferences, if it doesn't the app identifier (com.apple.Messages
) is probably wrong, so you'll need to do some digging to find out what it is.
Again let me stress that I haven't tested this second option on Mountain Lion or Messages at all, it's just based on how things work in previous versions of OS X.
- Quit Messages.
-
Open a terminal window and do:
defaults write com.Apple.iChat NSUserKeyEquivalents -dict-add "Close Conversation…" nil
Note that's a real ellipses character, either type ⌥; or just copy/paste from here.
Re-start Messages. Both Command-Delete (⌘⌫) and Option-Delete (⌥⌫) will now work as editing commands.
Control-K deletes the selection, or if there is no selection to the end of the current line. This works in any true Cocoa text view.
I use ⌘ + Shift + Left to select all the text on the line and then hit ⌫. To select all the text, I'd substitute that with ⌘ + A. It's not perfect, but it works.
Edit:
Based on CanuckSkier's answer, I've gotten the delete conversation message to
go away with the following command on the Terminal:
defaults write com.Apple.iChat NSUserKeyEquivalents -dict-add "Close Conversation…" nil
It's also a little cleaner than using the System Preferences method, because you have no command instead of an extra obscure one.