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

Re: Trouble with history



On Jan 31,  7:06am, Sam Giraffe wrote:
}
} I am having trouble getting zsh backward history search to work from
} the zsh history file.

Let's start by getting the history number into your prompt:

PROMPT='%h %~> '

If that number is greater than 1 when the shell starts up, then your
history is being read.

} My .zsh_history file is only 2,850 bytes, with 104 commands in it.

The next thing to note is that the default value for $HISTSIZE (the
number of commands the shell will keep in memory) is only 30, and you
have not reset it in the .zshrc that you sent, so only the most recent
30 commands from $HISTFILE would be kept; you won't be able to search
farther back than that.

The use of share_history can allow the HISTFILE to grow larger than
HISTSIZE.  Otherwise you'd normally want HISTSIZE to be at least as
large as SAVEHIST.

} When I type in Ctrl-R, the backward history search works only for the
} history items that were typed during the life of the shell.

There is a control for accessing only the current shell's history when
using share_history but it looks pretty unlikely that you've got that
turned on.  First let's confirm that your history is even being read.



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