Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've found an interesting paper: Predicting UNIX Command Lines about command-line prediction (based on user past activity), and I wonder if any actual implementation of such thing exists?

share|improve this question

2 Answers 2

Zsh comes with the insert-and-predict¹ edition widget, which makes it suggest completions spontaneously based on your command history.

¹ info -f zsh --index-search=predict-on or LESS=$LESS+/predict-on man zshcontrib on your machine.

To try it out:

autoload predict-on
predict-toggle() {
  ((predict_on=1-predict_on)) && predict-on || predict-off
}
zle -N predict-toggle
bindkey '^Z'   predict-toggle
zstyle ':predict' toggle true
zstyle ':predict' verbose true

And use Ctrl-Z to turn on or off.

share|improve this answer
    
It seems that this only uses history to offer what you have typed last time, that had the same beginning. Pretty much like ^R in bash. –  peterph Nov 21 '12 at 22:30
    
@peterph, That's what the documentation may let you think on a quick read but it goes beyond that and is very customisable. However I find it too annoying/intrusive to be usable (but maybe because I didn't spend (enough) time trying to tune it) –  Stéphane Chazelas Nov 21 '12 at 22:33
    
well, I guess this is a feature, that only gets useful for just a couple of repetitions. For anything more, either alias or a script are better. Unless it would of course really do some analysis on the commands to determine e.g. what arguments in subsequent commands correspond to each other (which the paper actually mentions as well). –  peterph Nov 21 '12 at 23:00

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.