[RLUG] vi key bindings for bash
Tim Hammerquist
penryu at penryu.org
Fri Jul 14 23:10:09 PDT 2006
TOP POSTING?!?!
Brandon Mitchell wrote:
> Grant Kelly <gkelly at gmail.com> wrote:
> > Try this in bash (or put it in ~/.bashrc):
> > set -o vi
> >
> > You can now edit your command line like it's in vi, including
> > using 'j' and 'k' (in command mode) to move down/up in your bash
> > history.
> >
> > Fun stuff...
Yeah, this was the most important discovery for me since learning vi
itself.
> For those that use tcsh, the same can be accomplished in your .cshrc
> with:
> bindkey -v
>
> or emacs with:
> bindkey -e
zsh is my preferred interactive shell, and it supports the same:
bindkey -v
To take this all a step further, add the following line to your
~/.inputrc :
set editing-mode vi
Now every app that uses the readline library (and there are a *lot*)
will also support vi keybindings. (NB: GUI app users probably won't
notice any difference whatsoever.)
Configuring all your other apps (mutt, slrn, etc) to allow vi-style
navigation is left as an exercise to the reader. (Or you could just
use Google Groups...)
HTH,
Tim
More information about the RLUG
mailing list