Skip to content

Commit b8e7659

Browse files
mono0xclaude
andcommitted
Replace zshaddhistory hook with HISTORY_IGNORE
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
1 parent 843bba3 commit b8e7659

1 file changed

Lines changed: 3 additions & 9 deletions

File tree

src/dot_config/zsh/zshrc.d/history.zsh

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,6 @@ setopt interactive_comments
1313
# hist_ignore_space (above) lets sensitive commands opt out.
1414
setopt share_history # noka: ZC1928
1515

16-
# http://mollifier.hatenablog.com/entry/20090728/p1
17-
# Return 2 keeps the line in the session history (reusable with ^p) but out of HISTFILE.
18-
_history_no_save() {
19-
local line=${1%%$'\n'}
20-
((${#line} >= 4)) || return 2
21-
[[ $line != (cd|ls)(|' '*) ]] || return 2
22-
}
23-
autoload -Uz add-zsh-hook
24-
add-zsh-hook zshaddhistory _history_no_save
16+
# Applied when lines are written to HISTFILE, so matches stay in the session
17+
# history (reusable with ^p) but out of the file.
18+
HISTORY_IGNORE='(?(#c,3)|(cd|ls)(| *))'

0 commit comments

Comments
 (0)