At Tue, 24 May 2005 09:36:56 +0800 (WST), jam  wrote:
> I love vi, but do not use the vi-command-edit option of bash.
> My mate who does asked me how to do this with the standard (emacs) shell
> edit functions:
> 
> /someword                     # look for a history event starting 'someword'
> <up>                          # previous history event starting 'someword'
> <cr>                          # execute THAT command

The bash/readline function you're looking for is
history-search-backward, which is not bound to any keys by default.

I'd bind it to M-p (if I was using bash) to make it similar to the old
tcsh behaviour (and its better than the default M-p function -
non-incremental-reverse-search-history)

Put this in ~/.inputrc to have it work for all readline-using programs:
 "\M-p": history-search-backward

or run this from your .bashrc if you only want to use it in bash:
 bind '"\M-p": history-search-backward'


For reference, zsh users would put this in .zshrc to get the same thing:
 bindkey -m   # get a meta key
 bindkey '\M-p' history-beginning-search-backward

-- 
 - Gus

-- 
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html

Reply via email to