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

Re: Infinite history size



On Dec 14,  6:48pm, Chris Down wrote:
} 
} In bash, and some other shells, this can be done by nullfying (note: not
} unsetting) HIST{,FILE}SIZE, and then making sure readline's
} "history-size" is -1.

I think what you've found there is a behavior of readline, not especially
a behavior of the shells in question.  Since zsh doesn't use readline, ...

On Dec 14,  7:53pm, Chris Down wrote:
}
} So I'll take the answer as "you can't" (although LONG_MAX is obviously
} not something that I'm going to reach :-) ).

Although setting a very large number is probably the easiest way, you
could do something along these lines:

    SAVEHIST=$(( $(wc -l $HISFILE) * 2 ))
    HISTSIZE=$SAVEHIST
    zshaddhistory() {
      if (( HISTNO == HISTSIZE ));
      then
        (( HISTSIZE *= 2 )) 
	SAVEHIST=$HISTSIZE
      fi
      return 0
    }

I haven't tested that, and obviously it needs some tweaking for cases
where file size actually becomes a significant fraction of LONG_MAX.



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