3 ms·
This is for zsh. If you are using bash, here's an alternative to save the commands, their start time, stop time, and eventual error code, in a SQLite database
by csdvrx 5y ago
This is for zsh.
If you are using bash, here's an alternative to save the commands, their start time, stop time, and eventual error code, in a SQLite database that you can query with fzy: https://github.com/csdvrx/bash-timestamping-sqlite https://github.com/csdvrx/bash-timestamping-sqlite
With the mappings, Ctrl-R will do a search history restricted to the current directory AND to successful execution (return == 0), while Ctrl-T will do a global history search for all directories and return values.
EDIT: to answer a question I've seen posted below, if you want to only navigate the commands from the current directory, do Ctrl-R then use the arrows: the command are by default sorted by the time they where previously run. If you then start typing letters, it will filter these commands using fzy.
- klyrs 5y agoIPython has a sqlite-backed history too. I manage to corrupt it frequently, presumably due to segfaults in extensions I'm developing, or because I rarely have fewer than 10 sessions open. I don't mind occasionally restarting IPython and very rarely nuking its history... but if that happened to me in bash, I'd be beyond frustrated. Is a non-concurrent database really a good idea here?
- ElectricalUnion 5y ago> non-concurrent database What does this even mean? Is this IPython backed history using Write-Ahead Logging? > I manage to corrupt it frequently, presumably due to segfaults in extensions A C-based program can't defend itself against corrupted memory. Your logger would need to run in a separated process from your actual code. https://www.sqlite.org/howtocorrupt.html#_memory_corruption https://www.sqlite.org/howtocorrupt.html#_memory_corruption