by Exuma · 6y ago · 0 comments
I set them as the Message Of The Day in my .zshrc (or .bashrc if you don't use zsh) until I memorized them. <c-f> is genric formatting for hotkeys, where c stands for control and you type "f" at same time.
IMPORTANT: For these to be level extremely effective you MUST REMAP your caps lock key to a control key. System Prefs > Keyboard > Modifier Keys button at bottom right
# MOTD
function echo_color() {
local color="$1"
printf "${color}$2\033[0m\n"
}
echo_color "\033[0;90m" "c-f Move forward"
echo_color "\033[0;90m" "c-b Move backward"
echo_color "\033[0;90m" "c-p Move up"
echo_color "\033[0;90m" "c-n Move down"
echo_color "\033[0;90m" "c-a Jump to beginning of line"
echo_color "\033[0;90m" "c-e Jump to end of line"
echo_color "\033[0;90m" "c-d Delete forward"
echo_color "\033[0;90m" "c-h Delete backward"
echo_color "\033[0;90m" "c-k Delete forward to end of line"
echo_color "\033[0;90m" "c-u Delete entire line"
Imagine you want to go up 2 lines to edit a HN comment. You could move your right hand to arrow key, or you can simply press caps with your pinky and type "p" with your other pinky. So much faster! Now you can see why these are so effective, and are really my favorite.Note that as you start to use these you will be pleased to see they apply in a lot of applications. For example, type command+L in chrome to jump to the address bar and highlight it, now type "news" in the address bar. The autocomplete dropdown will pop up. Now type control+n (readline move down) and you can scroll through the list.
I'm obsessed with optimizations and efficiency and the 2 things mentioned above are the absolute gems. Also, I highly recommend: https://medium.com/vunamhung/set-a-blazingly-fast-keyboard-r...
`0` is a little to fast for me so I prefer speed `1` and it's perfect.
Readline refers to the GNU readline library [1]
For in gnome-tweak-tool it is under "Keyboard & Mouse".
Note you can also set your command-line editing key to vi[m] also with "set -o vi". See https://unix.stackexchange.com/questions/30454/advantages-of...
Cursor keys came with the numeric keypad; IIRC, control keys debuted with “Saratoga”, the extended keyboard in 1987 (https://en.m.wikipedia.org/wiki/Apple_Keyboard#Apple_Extende... )
The shell reminder is a neat idea too; thanks for sharing that!
My Air has a JIS keyboard, so the control key is where your caps lock is. Most of my keyboards are configured this way (either physically or in software); on those that aren't, I use my opposing palm to press ctrl. I can't imagine using a Mac with flat keys and no right control =(
Because I make lots of use of control, I usually map Right Command to Right Control, so I can easily thumb control, command or option at practically any time.
My workaround is ⇧⌘→ followed by Backspace but that always feels a little awkward to me.
outside of terminal, c-a goes to beginning of line, and c-k deletes from the current cursor to the end of the line.
Perhaps you should try c-k instead of ⇧⌘→.
Backspacing however can be done by word by using c-w to delete back by word. Unfortunately this hotkey only works in terminal I think, so you'd have to do option+backspace in chrome, etc.
Iterm2, built in Terminal, bash shell.