history completion possible?

Scott Haneda talklists at newgeo.com
Wed Feb 17 15:37:52 PST 2010


On Feb 17, 2010, at 3:29 PM, Marko Käning wrote:

> Well, Bradley and Ryan,
> 
> I might be confused right now about the tab history completion. (Have to check again its exact behaviour on my linux laptop - when I feel the need to start it up again.) :)
> 
> BUT, the history completion with page up and down works differently to what arrow up and down do. The letter just scroll the history, page up and down search up and down in history for commands which start with the letters already typed in.
> 
> Say, I have entered the string "hg ci" in my command line. If I now use page up, bash will scroll through all my previous "hg ci" commands. I used this to quickly reuse old message strings, since page up would e.g. allow to reaccess something like "hg ci -m '- 12.2.10: account download' ".
> 
> I hope this makes it a bit clearer what I initially meant.

I have never had OS X work that way with the arrow up/down history, but I do enter this into my profile or similar:

PROMPT_COMMAND='history -a'
export HISTCONTROL="ignoredups"
export HISTIGNORE="&:ls:[bf]g:exit"

# -- shopt options, see shopt -p for all options --
shopt -s cdspell                                # Automatic spelling correction for `cd`
shopt -s cmdhist                                # Save multi-line cmd's as single line
shopt -s histappend                             # history list is appended to the file named by the value of the HISTFILE

Then I pretty control-R and have given a search though history possibility, that will bring up the last command that starts with the first few letters I typed in, I press control-R a few more times and it will cycle even deeper.

The settings above are pretty obvious, and do things like remove dupes in history, actually append the entries etc.  I have a pretty large .bash_history file that were someone to delete every again, thinking they were being cool by erasing their last commands, I would have to kill. :)

Is that what you are looking for?
-- 
Scott * If you contact me off list replace talklists@ with scott@ * 



More information about the macports-users mailing list