I created a patch to have sorted (first by number of previous runs, then by
most recent) and unlimited history. It is similar to the patch from Peter
John Hartman, but modified in the following ways:
1. The history is now unlimited.
2. The history stores a count of previous runs and automatically sorts them
in that order on save (with the most recent one first among those with the
same count).
3. Items in the history are shown only once in the results list, rather
than once from the history file and again from stdin.
Here's some examples of how the history file looks:
If I've previously run gvim 5 times, firefox 4 and sqliteman 3 I'll have
this as my history:
gvim 5
firefox 4
sqliteman 3
If I run firefox one more time I'll have this:
firefox 5
gvim 5
sqliteman 3
So far it's working great for me, but even with it limited to one line per
command the history could get very long and cause it to be slow to load,
but I suppose pruning that should be up to the user really.
Also, this is the first thing other than "Hello World" that I've ever
written in C, so the code may be horrible and/or do bad things. I hope not,
and there's certainly nothing intentionally malicious in here, but you've
been warned. I'm mostly just submitting this in case other people like the
idea and want to use and/or improve on it.
- Chris
Received on Mon Mar 11 2013 - 21:29:55 CET