Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: zshaddhistory confusion



On Sat, 1 Oct 2011, Jay Levitt wrote:

Benjamin Haskell wrote:
zshaddhistory () {
  print -sr -- "${1%%$'\n'}"
  fc -p ~/.zsh_history_detail
  print -sr -- "${1%%$'\n'} ### ${PWD} $(date '+%Y-%m-%d %R')"
  return 1
}

Thanks for the help! This fixes the double-write to .zsh_history_detail, but is still writing weird stuff to .zsh_history:

: 1317501595:0;echo autojump.zsh
: 1317501605:0;git st
: 1317501607:0;echo git st
: 1317501691:0;cd
: 1317501694:0;tail .zsh_history


By "weird stuff" I assume you mean the prefix?

': ' {timestamp} ':' {runtime} ';'

That's controlled by the 'extended_history' option. You can turn it off via:

setopt no_extended_history

I love it (It provides half of what you're adding with your hook.), but I've also wanted to add PWD to my historyfiles for a while.

--
Best,
Ben


Messages sorted by: Reverse Date, Date, Thread, Author