VI keymap for zsh
Although a bit confusing at first it's nice to be able to reuse many programmed in (mentally that is) keys. Lets get a run down:
Add to .zshrc:
bindkey -v
May the source be with you:
source ~/.zshrc
Now what does this mean? You'll basically start off in "insert" mode when the prompt comes up. Everything will work as normal, but you'll be able to Esc out to what is basically "normal" mode.
Basic "normal" mode:
h - move cursor back 1 character
l - move cursor forward 1 character
j - move back in history
k - move forward in history
/ - search backwards in history
? - search forward in history
Returning back to "insert" mode works:
i - at cursor
I - at beginning of line
a - after cursor
A - at end of line
Besides that everything is going to fall into place out of muscle memory. Most movements (^, $, w, e, b, %, others) seem to work great. So do yank and delete actions, but no "visual" mode for selection or any mode indication (possible doable through custom prompt?).
Enjoy.
Written by Sean Copenhaver
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#