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

truncated alternate history



Hello,

I found some odd behavior when using local history in zsh 4.3.10 -
the alternate history file seems to be loaded only up to the
global history number:

    $ yes | head -7000 > ~/longhistory
    $ historylength() { fc -p -a ~/longhistory 7000; fc -l 1 -1 | wc -l }
    $ historylength	# global history number is 4004
    4003                # expected 7000

The behavior seems to be correct if the history push/pop commands
are on separate lines:

    $ fc -p ~/longhistory 7000
    $ fc -l 1 -1 | wc -l
    6999
    $ fc -P
    # global history number is 4006

but fails when all commands are on the same line:

    $ fc -p ~/longhistory 7000;  fc -l 1 -1 | wc -l;  fc -P
    4005
    
Would it be possible to fix this?

On a side note - I have used this feature in a "scd" function that
allows to quickly search and change among recently visited directories.
The script installs a chpwd hook that pushes all visited directories
to the .scdhistory file; the recently visited directories are returned
at a top of the matchlist.

If there is any interest, I would be glad to post / contribute this script.

Thanks,

Pavol



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