I just recently switched from bash to zsh, however I miss my Alt+LeftArrowKey and Alt+RightArrowKey to go back and forth a word at a time.
Right now, if I press Alt+LeftArrowKey I go back a couple of letters and then I'm stuck. I won't go any further backwards and it won't back to the end of the line with Alt+RightArrowKey as I would expect. I can't even use the arrow keys to go to the end of the line, only to the second to last. Can't input new chars on the line either or indeed delete.
How do I get my beloved shortcut back?
I'm on Mac OS X using Terminal if that's important.
This helped! I use zsh (without oh-my-zsh), and I can confirm ctrl-u deletes the whole line.
Zsh Shift Select Mode. Emacs shift-select mode for Zsh – select text in the command line using Shift as in many text editors, browsers and other GUI programs. This plugin does not override any existing widgets and binds only shifted keys (see Key Bindings).
Run cat
then press keys to see the codes your shortcut send.
(Press Ctrl+C to kill the cat
when you're done.)
For me, (ubuntu, konsole, xterm) pressing Alt+← sends ^[[1;3D
, so i would put in my .zshrc
bindkey "^[[1;3C" forward-word
bindkey "^[[1;3D" backward-word
(Actually I prefer to use Ctrl + arrow to move word by word, like in a normal textbox under windows or linux gui.)
Related question: Fix key settings (Home/End/Insert/Delete) in .zshrc when running Zsh in Terminator Terminal Emulator
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With