4 ms·
I put "set editing-mode vi" in my ~/.inputrc to enable basic vi keyboard shortcuts in readline-based programs like bash. If I'm using bash on a machine I don't
by pmoriarty 9y ago
I put "set editing-mode vi" in my ~/.inputrc to enable basic vi keyboard shortcuts in readline-based programs like bash.
If I'm using bash on a machine I don't control, I can type "set -o vi" at the bash prompt to get the same thing temporarily, and that's usually the first thing I type.
I also like to use rlwrap[1] to get readline editing and command history on terminal apps that aren't readline aware and don't have history of their own.
Most of the time, though I spend in zsh, which is not readline-based but has its own readline-like capabilities. There I have ^R bound to reverse history search, and ^E to edit the current line in my $EDITOR.
In addition to this, I use fzy[2] (which I prefer over fzf[3]) to do fuzzy searches over my shell history with something like:
history 0 | perl -p -E's/^\s*\S+\s*//' | sort -u | fzy --lines=$LINES
[1] - http://utopia.knoware.nl/~hlub/uck/rlwrap/ http://utopia.knoware.nl/~hlub/uck/rlwrap/
[2] - https://github.com/jhawthorn/fzy/ https://github.com/jhawthorn/fzy/
[3] - https://github.com/junegunn/fzf https://github.com/junegunn/fzf