From 606be8570d7f4b189658e315f1a0e118c76081d9 Mon Sep 17 00:00:00 2001 From: Steven Lu Date: Fri, 19 Jul 2013 00:26:23 -0400 Subject: [PATCH] This is a fix to move away from bad crap shoved into the zsh history --- zshrc | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/zshrc b/zshrc index 73b889825..8dfd5c031 100644 --- a/zshrc +++ b/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 }