I want to move text up/down in Notes via the keyboard. I know it is possible in xcode with ⌘ + ⌥ + [ or ⌘ + ⌥ + ]. But it doesn't work in Notes. Any ideas?
-
1What is wrong with the ↑↓ keys?– MilliwaysFeb 1, 2015 at 1:24
-
1I dont neet to move cursor, but line with text– Bartłomiej SemańczykFeb 1, 2015 at 8:24
-
You have to cut and paste. The is no option on notes to do it. Your shortcuts indent and deindent on notes.app.– jherranFeb 1, 2015 at 10:36
4 Answers
CMD + CTRL and up or down arrows works in BigSur.
-
2
-
Building on David P.'s answer and a little Google-fu, I have come up with the following.
Create the file ~/Library/Keybindings/DefaultKeyBinding.dict
and enter the following, or, if the file already exists just add the entries in the "dict":
{
"~\UF700" = (
"moveToBeginningOfLine:",
"deleteToEndOfLine:",
"deleteForward:",
"moveUp:",
"yank:",
"insertNewline:",
"moveUp:"
);
"~\UF701" = (
"moveToBeginningOfLine:",
"deleteToEndOfLine:",
"deleteForward:",
"moveDown:",
"yank:",
"insertNewline:",
"moveUp:"
);
}
The behaviour mimics that of Visual Studio Code's Option-Up and Option-Down keybindings, which move the line up or down respectively and have the cursor follow the line. (Note that the cursor jumps to the beginning of the line, however)
Here's also an explanatory comment that you can add at the beginning of the file, as a cheatsheet if you need to edit this again in the future:
/*
Here is a rough cheatsheet for syntax.
Key Modifiers
^ : Ctrl
$ : Shift
~ : Option (Alt)
@ : Command (Apple)
# : Numeric Keypad
Non-Printable Key Codes
Standard
Up Arrow: \UF700 Backspace: \U0008 F1: \UF704
Down Arrow: \UF701 Tab: \U0009 F2: \UF705
Left Arrow: \UF702 Escape: \U001B F3: \UF706
Right Arrow: \UF703 Enter: \U000A ...
Insert: \UF727 Page Up: \UF72C
Delete: \UF728 Page Down: \UF72D
Home: \UF729 Print Screen: \UF72E
End: \UF72B Scroll Lock: \UF72F
Break: \UF732 Pause: \UF730
SysReq: \UF731 Menu: \UF735
Help: \UF746
OS X
delete: \U007F
For a good reference see http://osxnotes.net/keybindings.html.
NOTE: typically the Windows 'Insert' key is mapped to what Macs call 'Help'.
Regular Mac keyboards don't even have the Insert key, but provide 'Fn' instead,
which is completely different.
*/
This should be possible using Cocoa bindings - see this answer:
https://superuser.com/a/283948/659069
--
The example below (taken from the link above) binds a 'move line down' shortcut to Opt-DownArrow - you should be able to modify this to meet your needs.
Create the file ~/Library/Keybindings/DefaultKeyBinding.dict and enter the following:
{
"~\UF701" = (
"moveToBeginningOfLine:",
"deleteToEndOfLine:",
"deleteForward:",
"moveDown:",
"yank:",
"insertNewline:",
"moveUp:"
);
}
This will add the shortcut Opt-DownArrow for a line-swap command (with the line below) to every application supporting the Cocoa text system.
-
Answers on Ask Different need to be more than just a link. We expect answers to be self contained, since if your link goes down, your answer will be useless. Paraphrasing the source and including any relevant information in the answer will ensure it stays relevant– nohillside ♦Aug 2, 2019 at 12:23
-
1Super User is a Stack Exchange (internal) site, but I'll copy & paste the answer if needed.– David P.Aug 2, 2019 at 13:54
-
Jumping off-site makes for a bad user experience, also answers should ideally address/solve the problem described in the question.– nohillside ♦Aug 2, 2019 at 13:56