cantino / mcfly

Fly through your shell history. Great Scott!
MIT License
6.76k stars 176 forks source link

feature request: regex search #278

Open YAMLcase opened 1 year ago

YAMLcase commented 1 year ago

how doable would it be to add regex search to mcfly?

cantino commented 1 year ago

The search happens in SQLlite, so we could potentially use the REGEXP operator. How would you enter regexp mode?

YAMLcase commented 1 year ago

In vim cmd mode, hit / is what seems natural to me. But the better way would probably be an environment variable setting and then you just use regex in the normal search line. I think people will either use it all the time or never depending on their comfort level with regex.

cantino commented 1 year ago

You can currently do % as a wildcard BTW. Does that help?

YAMLcase commented 1 year ago

You can currently do % as a wildcard BTW. Does that help?

Oh yea, I found that last night and it helps a ton. Still, regex will shine when trying to find that vaguely remembered command from a year ago in the midst of 100's of similar iterations.

cantino commented 1 year ago

I'm open to contributions around this. It will need to be implemented in SQLite since that's where the search happens inside of McFly.

sou-chon commented 1 year ago

I can have a look at this. But REGEXP is not implemented in sqlite so will rely on external library / a custom function.

espdev commented 6 months ago

The search happens in SQLlite, so we could potentially use the REGEXP operator. How would you enter regexp mode?

Maybe use something like fzf search syntax instead of modes?

You can also use the config options. For example, most of the time I search for commands in history by first characters. I would like to use an option similar to "prefix-exact-match" in fzf but without ^ as a basic.