rabite0 / hunter

The fastest file manager in the galaxy!
Do What The F*ck You Want To Public License
1.31k stars 64 forks source link

Incremental search #7

Closed mfornet closed 5 years ago

mfornet commented 5 years ago

While searching using S it is useful to have incremental search to see partial match and correct search faster. Similar to incsearch in vim.

rabite0 commented 5 years ago

You're right.

Currently, when the minibuffer opens it (exec, search, filter, etc) it actually completely takes over the event loop like the process and log viewer, so it would need a kludgy workaround, like when resizing. I need to build a VBox, so that it can be used like any other widget. Then I can make filtering incremental as well.

Or maybe I just kludge it for now. Definitely on the todo list!

rabite0 commented 5 years ago

By the way, it's now possible to select files using an external program like fzf. You can also select a directory which you wan to enter. You need fzf for this to work in the default configuration, but you can also use something else that shows a selection on stderr and prints the final files to select/directory to enter on stdout.

The key bindings are: Alt(space) to select files and Alt(/) to select a directory to enter.

It's not quite incremental search (and incremental filtering would be nice, too), but it might be useful to you.

alok commented 5 years ago

Would https://github.com/lotabout/skim#use-as-a-library be helpful for this?

rabite0 commented 5 years ago

Only in so far as that you can use it as external searcher/selector.

The problem is that the prompt completely takes over the event loop at the moment, so there is no straightforward way to get input back to the rest of the program. It's essentially frozen until you hit enter. It also doesn't react to FS-events, etc. If that was fixed, or worked around, it would be as easy as updating the filter setting for the current folder with each letter one by one as they come, the rest is handled automatically.

I mean, it's not THAT hard, I just didn't get to it yet. Soon :).

rabite0 commented 5 years ago

OK, it's in. It just updates the filter after every key press, otherwise it works just as before, so there's no regex/wildcard support or anything like that. Might add that later.

Searching is also incremental now.