[vox-tech] vi key bindings, readline and bash

Peter Jay Salzman vox-tech@lists.lugod.org
Tue, 25 Mar 2003 16:23:07 -0800


begin Charles Polisher <cpolish@attbi.com> 
> Peter Jay Salzman wrote:
> 
> > > > > does it work for anybody?
> > > > 
> > > > Not here.
> > > 
> > > SuSE does the right thing as-is; this is from /etc/inputrc :
> > > 	$if mode=vi
> > > 	set editing-mode vi
> > > 	set keymap vi
> > > 	$endif
> > > and the environment has INPUTRC set to "/etc/inputrc",
> > > but that can be overridden with ~/.inputrc (bash refman p.82)
> > 
> > hi chuck,
> > 
> > i'm not sure how that can possibly be; seems really impossible.   just
> > to make absolutely sure, beyond a shadow of a doubt, can you tell me
> > what you mean by "does the right thing"?
> > 
> > there needs to be more than this, unless suse started hacking on
> > readline source code...
> 
> "Does the right thing":
> >From an ordinary bash prompt, with a typical U.S. installation
> of SuSE Linux 8.0, inside a standard xterm, logged in as an
> ordinary user, with no further customizations of the shell, 
> press the up-arrow key. The shell displays the most recently
> typed command from the shell history, without moving the cursor
> to a different line, but positioning the cursor just beyond the
> last character of the command. At this point, pressing the
> Enter key causes that displayed command to execute. Additional
> up-arrow key presses will go further back in the shell history,
> while down-arrow replaces the displayed command with more recent
> commands. 
> 
> "set keymap vi" is part of the standard Gnu bash distribution,
> as documented in the Bash Reference Manual, 2.5a-th ed., 11/2001.
> 
> Thusly speaketh the man page (excuse please the fleckths of
> thspittle on the thscreen, I blame the dentithst):
> 
>        keymap (emacs)
>               Set the current readline keymap.  The set of  valid
>               keymap  names is emacs, emacs-standard, emacs-meta,
>               emacs-ctlx, vi, vi-command, and vi-insert.   vi  is
>               equivalent  to  vi-command;  emacs is equivalent to
>               emacs-standard.  The default value  is  emacs;  the
>               value  of  editing-mode  also  affects  the default
>               keymap.
> 
> That "(emacs)" in the first line gives the default value.
> Also, under man 3 readline, the section on default key
> bindings lists the complete "VI Mode bindings". Werner Fink
> is credited with the inputrc file, which also has these lines:
> 
> $if term=xterm
> "\e[5;5~":  history-search-backward
> "\e[6;5~":  history-search-forward
> $endif
> "\e[C":     forward-char
> "\e[D":     backward-char
> "\e[A":     previous-history
> "\e[B":     next-history
> 
> Maybe that's the magic you've been looking for?

rats.

so it doesn't work on 2 debian testing systems.
it DOES work on a debian woody system
it works on a redhat 7.3 system (i just checked)
it works on your suse system

hrm.  i'm starting to think maybe this is a bug in debian/testing
readline bash.    :-/

when i get back home, i'll try using the inputrc sitting on the redhat
7.3 machine that it worked on.

pete

-- 
Fingerprint: B9F1 6CF3 47C4 7CD8 D33E 70A9 A3B9 1945 67EA 951D