I often find myself executing commands like this at bash :
history | grep 'find'
For example to look up a fancy find / xargs command i might have ran.
Im wondering --- where does the "lein repl" store its historical data ? It would be nice to know, because then I could write a leingrep.sh script, which simply grepped through the lein history session.
It is obvious that this is on disk somewhere, since history is preserved from one repl to the next.
Lein is using either readline (if you have it installed) or jline (if you are so unfortunate, I recommend installing readline). I wouldn't bother trying to look up the history file on disk - just press Ctrl-r, type in your search text, and keep hitting Ctrl-r until you find whatever you were looking for. This is a general readline feature, and will work in any readline app (including bash).
Once you get going with readline there are a couple controls to consider, via your ~/.inputrc
file.
I'm not finding the default "history size" documented, but I'm guessing it's only ~100. I often lose some older entries I wished I'd had around. Also, "vi-mode" is wonderful thing for vi users. Together these (with a bonus) in .inputrc
become:
set history-size 10000
set editing-mode vi
# Only require 1 tab for completion.
set show-all-if-ambiguous on
Note that this config will affect a lot of repl tools, like gdb, irb/pry, lein, psql, ipython, R, ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With