ddworken / hishtory

Your shell history: synced, queryable, and in context
https://hishtory.dev
MIT License
2.49k stars 47 forks source link

Searching with exact match #135

Closed zhou13 closed 10 months ago

zhou13 commented 10 months ago

Sometimes, it is convenient to have an option to search with exact match. Let's say I want to search for for i in. Right now, I got

Screenshot 2023-11-28 at 11 06 18 AM

which are not very relevant. It would be nice if we could have a way to toggle the exact match vs fuzzy search or to enter a regular expression manually.

ddworken commented 10 months ago

Currently, this is already possible by typing in a query like for\ i\ in that escapes the spaces. But I think you are right that we're missing any documentation for this, and that we could probably make this clearer. WDYT of adding support for just quoting anything that you want to be an exact match? That way it would be possible to have a query like "for i in" cwd:/tmp/foo/.

zhou13 commented 10 months ago

Thank you! Quoting is probably the most intuitive way to do this.

mustafa0x commented 10 months ago

I wonder does fzf's fuzzy matching score the same?

I copied the below two lines, then ran pbpaste | fzf, and it seemed to score correctly, but I can't say that my test is conclusive.

history config-set timestampt-format
for i in
ddworken commented 10 months ago

Thanks for that comment @mustafa0x! I think that is conceptually a separate feature request, so I opened #158 to track that improvement. Marking this one as closed, but please let me know if you have any other thoughts on exact match searches.