Archive for the ‘zsh’ Category

Ctrl + Left or Right arrow

November 17, 2016 Leave a comment

A colleague introduced me to using “Option + Left” shortcut on OSX. I’d like to set this up on my debian box.

Option/Alt + Left or Right

This shortcut allows you to move the cursor between separate words in a command line. Use Option and the left arrow to move back and use Option with the right arrow to move forward down the line.

I’ll be using “Ctl + Left” to move back and “Ctl + Right” to move forward between separate words.

For bash:
Add the following to .inputrc

"\e[1;5D": backward-word
"\e[1;5C": forward-word

For zsh:
Add this to .zshrc

bindkey '^[[1;5C' forward-word
bindkey '^[[1;5D' backward-word

To find out what is being sent by the keyboard. Type Ctrl + C to quit.

$ cat -v    
# When pressing Ctrl + Left Arrow                           

# When pressing Ctrl + Right Arrow

Source: (Look at the “How can I see what my keyboard sends?” section)

Categories: bash, Interesting, zsh Tags: