docs: update readme

This commit is contained in:
Viktor Varland 2025-02-28 16:01:58 +01:00
parent 12ac4b86c2
commit f538b45e84
Signed by: varl
GPG key ID: 7459F0B410115EE8

View file

@ -1,30 +1,27 @@
# shell-history
## setup
## zsh
`~/.zshrc`:
```
HISTDB="$HOME/dev/vlv/histdb"
SHISTDB="$HOME/dev/vlv/histdb"
SHIST="$HOME/dev/vlv/shell-history"
autoload -Uz compinit promptinit add-zsh-hook
_history() {
if test "$(id -u)" -ne 0; then
echo "$(date --utc --iso-8601=seconds) $(hostname) $(pwd) $(fc -ln -1)" >> \
$HISTDB/zsh-history-$(date "+%Y-%m-%d").log;
$SHISTDB/zsh-history-$(date "+%Y-%m-%d").log;
fi
}
add-zsh-hook precmd _history
_history-sync() {
if [[ -d "$HISTDB" ]]; then
if [[ -d "$SHISTDB" ]]; then
() {
pushd -q "$HISTDB"
pushd -q "$SHISTDB"
source "$SHIST/sync.sh"
popd -q
}