Question

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?

Was it helpful?

Solution 4

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.

OTHER TIPS

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.

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

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$"]}]}]}]}

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top