mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-01-30 02:44:42 +01:00
This is a fix to move away from bad crap shoved into the zsh history
This commit is contained in:
parent
be527c83d0
commit
606be8570d
1 changed files with 10 additions and 2 deletions
12
zshrc
12
zshrc
|
|
@ -42,7 +42,7 @@ source $ZSH/oh-my-zsh.sh
|
|||
# normal practices. This inserts a few more things that I use from the shell.
|
||||
export PATH=~/bin:~/util:$PATH:/usr/local/share/npm/bin
|
||||
|
||||
[[ $(id -u) == 0 ]] && export PATH=/usr/local/bin:$PATH
|
||||
# [[ $(id -u) == 0 ]] && export PATH=/usr/local/bin:$PATH
|
||||
# export PAGER=vimpager
|
||||
|
||||
# zmodload zsh/complist
|
||||
|
|
@ -77,13 +77,21 @@ source $ZSH/plugins/history-substring-search/history-substring-search.plugin.zsh
|
|||
export HISTSIZE=20000
|
||||
export SAVEHIST=200000
|
||||
|
||||
# This is an independent save of the history and terminal's cwd.
|
||||
# This avoids problems that crop up when I try to squish the cwd into the history entry.
|
||||
function zshaddhistory() {
|
||||
COMMAND_STR=${1%%$'\n'}
|
||||
[[ ( -z $COMMAND_STR ) || ( $COMMAND_STR == history ) || \
|
||||
( $COMMAND_STR =~ ^l(s\|l\|a)?$ ) || \
|
||||
( $COMMAND_STR =~ ^(d\|gd\|git\ diff\|glp\|gg)$ ) \
|
||||
]] && return 1
|
||||
print -sr "${PWD}///; ${COMMAND_STR}"
|
||||
# do not do anything on common commands
|
||||
|
||||
# do the needful
|
||||
echo "$PWD; $COMMAND_STR; $TTY@$(date +%s.%N)" >> ~/.zsh_enhanced_history
|
||||
|
||||
# rest is "default" zshaddhistory()
|
||||
print -sr "${COMMAND_STR}"
|
||||
fc -p
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue