1 parent 5bb53a5 commit 843bba3Copy full SHA for 843bba3
1 file changed
src/dot_config/zsh/zshrc.d/history.zsh
@@ -14,9 +14,11 @@ setopt interactive_comments
14
setopt share_history # noka: ZC1928
15
16
# http://mollifier.hatenablog.com/entry/20090728/p1
17
-_history_min_length() {
+# 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'}
- ((${#line} >= 4))
20
+ ((${#line} >= 4)) || return 2
21
+ [[ $line != (cd|ls)(|' '*) ]] || return 2
22
}
23
autoload -Uz add-zsh-hook
-add-zsh-hook zshaddhistory _history_min_length
24
+add-zsh-hook zshaddhistory _history_no_save
0 commit comments