peterh / liner

Pure Go line editor with history, inspired by linenoise
MIT License
1.04k stars 132 forks source link

support substring pattern mode for history searching #162

Open while-loop opened 1 year ago

while-loop commented 1 year ago

This PR adds support for different history search mode.

The default mode is left unchanged where using up/down keys will search the State's history via prefixed strings. We add a new mode where searching will match on the index of the pattern rather than prefix.


This is inspired by the oh-my-zsh zsh-history-substring-search plugin.

This is a clean-room implementation of the Fish shell's history search feature, where you can type in any part of any command from history and then press chosen keys, such as the UP and DOWN arrows, to cycle through matches.

while-loop commented 1 year ago

Hey @peterh 👋 This PR should be good to go 👍. I've been testing this for a few weeks now