Say I have the following entries in my command history:

less documents/doc1.txt
less documents/doc2.txt
less files/file1.txt
less files/file2.txt

and that I have the following keyboard binding enabled:

bindkey '^P' history-search-backward

I have noticed that if I then type:

less documents

ZLE brings

less files/files2.txt

as the first option, rather than:

less documents/doc2.txt

Why is that? Is there a way to make history-search fix everything on the left of my cursor and iterate through the history with it?

bindkey '^P' history-beginning-search-backward

You might prefer up-line-or-history-beginning-search.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.