Messages – Make ‘Return’ Behave like a ‘Return’ in Shortcuts

messagesshortcut

I am using Messages on both Macs & iPhones and I am typing a lot of E-mails.
Within all these environment I am used to the normal behaviour of the return key.

Within Messages this key doesn't behave as a return key thus causing me to prematurely send truncated messages.

I found this very similar question: How to insert new line on return key press in iMessage on Mac OSX and I already knew the workarounds proposed ctrl+return, alt+return. But these workarounds didn't answer the original question. Moreover I already use them but this still leave me with an
unacceptable error rate.

From my point of vue, the return should never be associated with a "function" within an environment where you
are at typing text. This is a huge ergonomic design error.

I tried to override the actual shortcut mapping with:

defaults write com.apple.iChat NSUserKeyEquivalents '{ "                            
" = "insertNewline:" ; }

Which is a silent failure.

I suspect that the syntax of the function might be wrong, but Messages doesn't write any error about this.

Is there a documentation about the exact syntax of internal Messages functions which can be called from a shortcut?

Is there any other correct way to make the return behave as a plain return?

Best Answer

Create a file (on a standard install, the directory KeyBindings doesn't exist):

mkdir ~/Library/KeyBindings

containing the following 2 remappings:

$ cat >~/Library/KeyBindings/DefaultKeyBinding.dict <<end_of_file
/* my keybindings */
{
        "\U000d" = ("insertLineBreak:") ;
        "@\U000d" = ("insertNewline:") ;
}
end_of_file

@ means cmd in this dictionary, \U000d means Unicode of the standard return (== 0x0d).

Restart Messages and from now on,

  • return will put a real return,

  • cmd+return will send the message.


Drawback

This solution is applied to any application using ~/Library/KeyBindings/DefaultKeyBinding.dict.

Advantage

This solution is applied to any application which does a non natural use of the return in a text area. Most notably I now have a Skype with which I don't send any more prematurely truncated messages.