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

Re: vi mode and history-search key binding



B

On Sat, 27 May 2006, Bart Schaefer wrote:

On May 27,  8:39pm, William Scott wrote:
}
}       bindkey '\e[A'  vi-history-search-backward
}       bindkey '\e[B'  vi-history-search-forward

This binds those keys in the main keymap, which by default is the emacs
keymap.  Have you somewhere earlier in your startup files executed a
"bindkey -v" command?  If you did, then those bind keys in the viins
keymap (insert mode), not the vicmd keymap (command mode).  In which
mode are you attempting to invoke the search?

} It appears to have no effect. Is this intended?

The effect you should see is that a quetion-mark (for backward) or slash
(for forward) prompt appears below the PS1 prompt; you then enter the
string to search for.  If that doesn't happen, you've probably bound
the keys in the wrong keymap.



Sorry, I misunderstood what vi-history-search-forward, etc, does.

        bindkey -v
        bindkey '\e[A'  history-search-backward
        bindkey '\e[B'  history-search-forward

gives me the desired behavior.


Thanks for pointing out what should have been obvious.  (I just issued
bindkey -v on the command line to experiment. I'm not sure what it says
about the ossified state of my brain, but even as a vi(m) user, I can't
seem to break the emacs keybinding habbits in the shell. It was far easier
to switch from tcsh to zsh. I'll give it the weekend.)




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