dotfiles/zsh/.config/zsh/opts.zsh

43 lines
1.2 KiB
Bash

# History Config
setopt interactivecomments
setopt EXTENDED_HISTORY
setopt HIST_EXPIRE_DUPS_FIRST
setopt HIST_IGNORE_DUPS
setopt HIST_IGNORE_ALL_DUPS
setopt HIST_IGNORE_SPACE
setopt HIST_FIND_NO_DUPS
setopt HIST_SAVE_NO_DUPS
setopt HIST_BEEP
setopt INC_APPEND_HISTORY
setopt HIST_FCNTL_LOCK
setopt SHARE_HISTORY
setopt AUTO_CD
# History file configuration - per host
HISTORY_IGNORE='(*.git/hooks*)'
LESSHISTFILE="-"
HISTFILE="$ZDOTDIR/zsh_history_$HOST"
HISTFILESIZE=100000
HISTSIZE=100000
SAVEHIST=100000
# Ensure history file exists and has proper permissions
if [[ ! -f "$HISTFILE" ]]; then
touch "$HISTFILE"
chmod 644 "$HISTFILE" # More permissive permissions
fi
# Additional history safeguards
# Backup history on each session start (only if file is significantly large)
if [[ -f "$HISTFILE" && -w "$HISTFILE" ]]; then
# Create backup if history file is large enough (> 10KB) to avoid frequent small backups
if [[ $(stat -f%z "$HISTFILE" 2>/dev/null || stat -c%s "$HISTFILE" 2>/dev/null) -gt 10240 ]]; then
cp "$HISTFILE" "${HISTFILE}.bak" 2>/dev/null || true
fi
fi
# Minimal prompt configuration
MNML_INFOLN=()
MNML_PROMPT=(mnml_ssh mnml_status 'mnml_cwd 2 0' mnml_git mnml_keymap )
MNML_RPROMPT=()
MNML_NORMAL_CHAR="◉"