simple multi-computer shell history
Find a file
2025-06-16 13:48:40 +02:00
README.md feat: add search capabilities with fzf+rg 2025-06-16 13:48:40 +02:00
search.sh feat: add search capabilities with fzf+rg 2025-06-16 13:48:40 +02:00
sync.sh feat: add search capabilities with fzf+rg 2025-06-16 13:48:40 +02:00

shell-history

zsh

cd $HOME/dev/vlv
git clone git.meatbag.se:vlv/shell-history.git shell-history
mkdir histdb

~/.zshrc:

autoload -Uz compinit promptinit add-zsh-hook

histdb_dir="$HOME/dev/vlv/histdb"
histcmd_dir="$HOME/dev/vlv/shell-history"

_add_history() {
    if test "$(id -u)" -ne 0; then
        echo "$(date --utc --iso-8601=seconds) $(hostname) $(pwd) $(fc -ln -1)" >> $histdb_dir/zsh-history-$(date "+%Y-%m-%d").log;
    fi
}
add-zsh-hook precmd _add_history

hsup() {
    () {
        source $histcmd_dir/sync.sh "$histdb_dir"
    }
}

hs() {
    () {
        source $histcmd_dir/search.sh "$histdb_dir" "$@"
    }
}