abo-abo / swiper

Ivy - a generic completion frontend for Emacs, Swiper - isearch with an overview, and more. Oh, man!
https://oremacs.com/swiper/
2.31k stars 338 forks source link

ivy--regex-plus vs ivy--regex-fuzzy #2303

Open maciejw-cdns opened 5 years ago

maciejw-cdns commented 5 years ago

Hi, I am very happy with the solution which I put into my workflow that during counsel-find-file I press my keystroke to evolve it into counsel-file-jump to switch into recursive file search. It all works well but if there are many candidates, ivy--regex-fuzzy matching structure does not filter well these as it looks into dirs too in typing pattern. If I switch to ivy--regex-plus, I could define ./ prefix to move searcher into file name only but I need to use space as separator in file search pattern which I want to avoid. Defining ./ as the initial input to ivy--regex-fuzzy seems to give it no regexp chars. So my question is: Is it a way to use counsel-file-jump with ivy--regex-fuzzy matching structure being able to get initial input as regex (e.g. .*/).

Thanks a lot.

abo-abo commented 5 years ago

This could be fixed by extending ivy--regex-fuzzy. Here's how it works now:

(ivy--regex-fuzzy "abc")
;; => "\\(a\\)[^b\n]*\\(b\\)[^c\n]*\\(c\\)"

If you can figure out how you want it to behave, please give your idea. Or maybe even PR.

maciejw-cdns commented 5 years ago

I think that ivy--regex-fuzzy function can be extended to have the new optional input argument called kinda 'initial-regex-input' - just like in counsel-file-jump. The problem might be that some upper level functions heavily use ivy--regex-fuzzy so updating ivy to support this optional argument may not be trivial. It seems that the easiest way could be to define brand new function called kinda ivy--prefix-regex-fuzzy which would work in the same way as ivy--regex-fuzzy but with regexp prefix.