How do I make a keyboard shortcut for the return
key? For example, if I pressed ~
it would press return
for me. I'd like to do this without applescript. Is this possible, or will I have to buy a functioning external keyboard because my return key doesn't work!
-
1While there is an accepted answer below and this question was a pretty good academic exercise, I have to put on my "operations hat" on for a sec and say that in the name of productivity, you should get a new keyboard. This is like trying to go from Miami to New York by way of Alaska.– AllanCommented May 3, 2016 at 15:53
2 Answers
Download, install and start Karabiner. In the menubar open (Karabiner icon)-> Preferences. Enter "Return" in the search field and choose one of the preconfigured key codes:
By editing the private.xml in Misc & Uninstall you may add any additional key or (not already used) key combination and choose this one instead.
-
Karabiner can't download without an admin username and password. Is there any way to just get the app, and not the DMG?– ALXCommented Mar 12, 2016 at 18:46
-
-
No, I'd need the ZIP, not the DMG to open it... forgot my admin password and don't want to go through the steps to retrieve or reset it.– ALXCommented Mar 12, 2016 at 19:11
-
@ALX The admin password is obligatory because AFAIR you have to install a launch daemon and a launch agent. Commented Mar 12, 2016 at 19:21
-
Darn... Well, I guess I'll have to go back and retrieve my password– ALXCommented Mar 12, 2016 at 19:22
You can do this without being admin on your Mac, and with a simple creation of a key binding file.
Create a file (on a standard install, the directory KeyBindings
doesn't exist):
mkdir ~/Library/KeyBindings
containing the following remapping:
$ cat >~/Library/KeyBindings/DefaultKeyBinding.dict <<end_of_file
/* my keybindings */
{
"\U007e" = ("insertNewline:") ;
}
end_of_file
\U007e
means Unicode of the standard ~
character (== 0x7e
). You can't use "~"
in this dictionary because it means option.
(I suggest to avoid the use of the character ~
because it is used
in command environnment to mean ${HOME}
. For example if you want to
use option+/, put "~/"
in place of "\U007e"
.)
And restart your session.
To suppress this key binding, just remove this file:
rm ~/Library/KeyBindings/DefaultKeyBinding.dict
and if you dont need it, remove also the useless directory:
rmdir ~/Library/KeyBindings
and restart your session.