Reputation: 1243
One of the killer features of the readline line editor is the ability to type the first few characters of a command in one's history and then up-arrow to get to it. For instance, if I have 'grep "te' in the zle buffer, the up-arrow key iterates through grep commands whose first two search characters are 't' and 'e'. In my current zsh configuration, the up arrow key does not do such filtering. Are there zle commands/widgets that would give the type of filtering I want?
Upvotes: 3
Views: 153
Reputation: 531808
The widget you are looking for is history-beginning-search-backward
. You can bind it to up arrow using
bindkey "^[OA" history-beginning-search-backward
or
bindkey "^[[A" history-beginning-search-backward
depending on which escape sequence your up-arrow key sends (you can just use both, to be safe).
Upvotes: 4