After adding the following lines to my .zshrc:
autoload -U up-line-or-beginning-search autoload -U down-line-or-beginning-search zle -N up-line-or-beginning-search zle -N down-line-or-beginning-search bindkey "^[[A" up-line-or-beginning-search bindkey "^[[B" down-line-or-beginning-search
exec zsh (from zsh), and the lines above did not take effect. I then did the following (not sure this context is necessary, but maybe relevant):
exit to drop me back into my login shell (bash),
exit to log out, then
ssh machine to log back in, then
exec zsh, and then the lines above were working.
Does anyone know why?
My title question was incorrect. It turns out that .zsh is behaving inconsistently from login to login with regard to the lines above only. Sometimes they work as expected, sometimes they do not. I've attempted to find a pattern, but cannot. I think (but am not sure) login is key as once I've
sshed into the machine, the behavior seems to remain the same regardless of different zsh instances.
The output from
read (up) (down) is always the same as is the output from
history 0 and the up and down arrows otherwise seem to behave themselves.
May or may not be useful info--for the failing case (I haven't been able to get it to work in a while now):
%bindkey | grep 'or-beginning' "^[[A" up-line-or-beginning-search "^[[B" down-line-or-beginning-search %zmodload | grep zle zsh/zle %up-line-or-beginning-search up-line-or-beginning-search:zle:19: widgets can only be called when ZLE is active up-line-or-beginning-search:zle:21: widgets can only be called when ZLE is active %read ^[[A^[[B^C% (up,down,ctrl-c)