2

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?

  • Any tweak may be dependant on you having both Return & Enter keys on your keyboard [not that I have an answer, just that laptops tend to only have one general purpose Ret/Enter, whereas desktops have both] – Tetsujin Apr 25 '16 at 18:24
  • I have many keyboards on which I am working, some of them do have an enter key others don't (Mac Book Pro). Anyway, the key I have problem with is the key which is basically designed to enter a return many times per minute and is purposefully one of the larger of any keyboard. •••• I want my return :) ! – dan Apr 27 '16 at 8:34
4

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.

  • Hm, but is it a problem really, especially with Skype? it uses the standard keyboard behavior, alike other messengers do, so it's quick to get used to default behavior. I'm almost not using a mouse/touchpad, only keyboard combinations, and the chance of sending truncated messages almost absent. – Farside May 2 '16 at 21:20
  • 1
    It was regularly a problem because I am fast at typing and the return is a regular one I use. •••• This nightmare is now finished :). – dan May 3 '16 at 15:55
  • Thank you so much for this, just what I was looking for. – James P Nov 21 '16 at 10:18
  • Blessing on you and your house for 7 generations. Is there a way to make it specific to a given application? – Sherwood Botsford Sep 6 '17 at 18:39
  • @SherwoodBotsford: have a look at this other answer (down here) which I am now using since 2 years: apple.stackexchange.com/a/247214/22003 . – dan Sep 7 '17 at 12:30
4

In Messages the keyboard combination to insert "new line" is:

  • CTRL + ↩︎ Return

It will not send the message, but will insert return carriage sign (a new line).

I'm using this all the time, when writing SMS/iMessages from MacBook... but yes, not really comfortable, as way too much of accidents when you are sending the truncated messages.

In most of Applications alike Skype and other Messengers insert of new line works on next keyboard shortcuts:

  • CTRL + ↩︎ Return
  • ⌥ Option + ↩︎ Return

I do not recommend to override these shortcuts, as it's common-knowledge and standard behavior when working with Messages and Messengers.

In text processors, code editors and email editors have different behavior, as you see the big text area, and ↩︎ Return acts as a "new line" action. Modifiers alike CTRL, ⌥ Option, ⌘ Command might work as additional functionality to insert "soft" new line, to insert new page, line break delimiter, etc.


You might want to use BetterTouchTool, which is was a free utility which can disable keyboard shortcuts (and has many other uses). The list of your actions to disable/enable the shortcut could be next:

  1. Install BetterTouchTool
  2. Click on the BetterTouchTool menubar item and choose Preferences
  3. Click on Keyboard
  4. Click the plus sign at the bottom of the Select Application: pane
  5. Choose Messages (in /Applications folder)
  6. Click + Add New Shortcut
  7. Click Keyboard Shortcut, hit return
  8. Click Trigger Other Keyboard Shortcut, hit ctrl+return
  9. Leave Trigger Predefined Action: to No Action (which is the default)
  10. repeat steps 7,8 & 9 to remap cmd+return to shift+return

Which should lead to such a screen: Better Touch return remapping

1

Karabiner has changed, need json file now: paste below into a text file, rename to messages.json and then copy into: ~/.config/karabiner/assets/complex_modifications/ then add the two rules via the app

{"title":"Mac Messages return-key modify","rules":[{"description":"Use Return as New Line","manipulators":[{"type":"basic","from":{"key_code":"return_or_enter"},"to":[{"key_code":"return_or_enter","modifiers":["control"]}],"conditions":[{"type":"frontmost_application_if","bundle_identifiers":["^com\.apple\.iChat$"]}]}]},{"description":"Use Control Return as Send","manipulators":[{"type":"basic","from":{"key_code":"return_or_enter","modifiers":{"mandatory":["control"]}},"to":[{"key_code":"return_or_enter"}],"conditions":[{"type":"frontmost_application_if","bundle_identifiers":["^com\.apple\.iChat$"]}]}]}]}

0

Install Karabiner

Which can be found there: Karabiner: a keyboard customizer for OS X

Make a private.xml

Read the Karabiner documentation on the topic: private.xml Reference Manual

Create the ${HOME}/Library/Application Support/Karabiner/private.xml with the following content:

<?xml version="1.0"?>
<root>
  <appdef>
    <appname>MESSAGES</appname>
    <equal>com.apple.iChat</equal>
    <equal>com.skype.skype</equal>
  </appdef>
  <item>
    <name>Messages return modification</name>
    <appendix>Change Return to Newline</appendix>
    <appendix>Change Newline to Return</appendix>
    <identifier>swap Return and Newline</identifier>
    <only>MESSAGES</only>
    <autogen>__KeyToKey__ KeyCode::RETURN, ModifierFlag::COMMAND_L, KeyCode::RETURN</autogen>
    <autogen>__KeyToKey__ KeyCode::RETURN, KeyCode::RETURN, ModifierFlag::CONTROL_L</autogen>
  </item>
</root>

Depending upon your taste, use vi, emacs or TextEdit (but of course not Word).

Load your private.xml

Tell Karabiner you will use a custom setting: Use prepared settings

and load it: Apply prepared settings

Test it

Start Messages or Skype and check that you can type return within any message and send a message with command ⌘return.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .