Skip to content

Commit d8defee

Browse files
rakeshpetitpurinkle
authored andcommitted
improve zsh history
1 parent 07bff4f commit d8defee

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,22 @@ can add the `virtualenv` file, another `keys`, and a third `chpwd`.
156156

157157
The `~/dotfiles-local/zshrc.local` is loaded after `~/dotfiles-local/zsh/configs`.
158158

159+
## zsh History Configurations
160+
161+
The zsh history is configured with several useful options:
162+
163+
- `hist_ignore_all_dups`: Removes duplicate commands from history
164+
165+
- `hist_ignore_space`: Commands starting with a space are not saved to history
166+
(useful for sensitive commands)
167+
168+
- `inc_append_history`: Adds commands to history as they're executed, not just
169+
when the shell exits
170+
171+
- `share_history`: Shares history across multiple zsh sessions in real-time
172+
173+
History size is set to 8,192 entries providing ample command history.
174+
159175
## vim Configurations
160176

161177
Similarly to the zsh configuration directory as described above, vim

zsh/configs/history.zsh

100644100755
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
setopt hist_ignore_all_dups inc_append_history
1+
#!/usr/bin/env zsh
2+
3+
setopt hist_ignore_all_dups hist_ignore_space inc_append_history share_history
4+
25
HISTFILE=~/.zhistory
3-
HISTSIZE=4096
4-
SAVEHIST=4096
6+
HISTSIZE=8192
7+
SAVEHIST=8192
58

69
export ERL_AFLAGS="-kernel shell_history enabled"

0 commit comments

Comments
 (0)