zsh-users
 help / color / mirror / code / Atom feed
* Trouble with history
@ 2015-01-31 15:06 Sam Giraffe
  2015-01-31 18:33 ` Bart Schaefer
  0 siblings, 1 reply; 3+ messages in thread
From: Sam Giraffe @ 2015-01-31 15:06 UTC (permalink / raw)
  To: zsh-users

Hi,

I am having trouble getting zsh backward history search to work from
the zsh history file.
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.
If I close the shell and open another shell, then the backward history
search resets itself.

My .zsh_history file is only 2,850 bytes, with 104 commands in it.
I need help in getting zsh to read the history file for backward history search.
Below is my zsh configuration file.

~> cat .zshrc
export PATH=/usr/local/bin:$PATH
autoload -Uz compinit && compinit
setopt cdablevars
setopt correct
setopt correctall
setopt autocd
setopt globdots
SAVEHIST=500
HISTFILE=~/.zsh_history
setopt inc_append_history
setopt share_history
setopt extendedglob
setopt notify
PROMPT='%~> '
alias -g ls='ls -GF'
source ~/.oh-my-zsh/plugins/git/git.plugin.zsh

Thank you!


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Trouble with history
  2015-01-31 15:06 Trouble with history Sam Giraffe
@ 2015-01-31 18:33 ` Bart Schaefer
  2015-02-01  6:58   ` Sam Giraffe
  0 siblings, 1 reply; 3+ messages in thread
From: Bart Schaefer @ 2015-01-31 18:33 UTC (permalink / raw)
  To: zsh-users

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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Trouble with history
  2015-01-31 18:33 ` Bart Schaefer
@ 2015-02-01  6:58   ` Sam Giraffe
  0 siblings, 0 replies; 3+ messages in thread
From: Sam Giraffe @ 2015-02-01  6:58 UTC (permalink / raw)
  To: Bart Schaefer; +Cc: zsh-users

Thank you, setting HISTSIZE to match SAVEHIST solved my problem. :)

On Sat, Jan 31, 2015 at 10:33 AM, Bart Schaefer
<schaefer@brasslantern.com> wrote:
> 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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-02-01  6:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-31 15:06 Trouble with history Sam Giraffe
2015-01-31 18:33 ` Bart Schaefer
2015-02-01  6:58   ` Sam Giraffe

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).