Yevgnen / ivy-rich

More friendly interface for ivy.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Search for a phrase through entire file path not only buffer name

farynaio opened this issue · comments

Is it possible to make ivy-rich search for a phrase through entire file path not only buffer name?

As noted in README and #28, I'm afraid it is not possible to find an easy solution currently. But there's some efforts tried by the community. If anyone has suggestions on this, I'm glad to work on it.

I'd be also interesting in matching the path (in ivy-switch-buffer), and also the project name. Looking at the code, I do not understand how the matching actually works. It looks like ivy will match the whole string, but then why is ivy-rich only matching against the buffer name? Is there some alist magic somewhere, mapping the buffer name to a display string? I think the easiest way to allow matching more than the buffer name would be to simply match everything in the whole line, and I have problems understanding why that should be a problem.

@publicimageltd Hi, ivy-rich does not do any 'match' and just use ivy's transformer mechanism to display strings (So ivy knows nothing about whatever being added to the candidate). 😅Due to my limited Elisp knowledge, you may need to dig into how ivy matches, displays and highlights matches. (My best guess is: how it matches and highlights matches are two different things. And candidates are filtered and fixed before they are transformed, otherwise, it may cause some infinite loop if filtering happens again after they are transformed because again these transformed candidates need to be transformed).

Thanks, I might take the time to find out how ivy does that.

I have proposed a simple modification to ivy which allows to filter based on additional columns supplied by ivy-rich (or any user-supplied transformer function), on a per-command basis (i.e. in my personal case I use it only to modify the behavior of ivy-switch-buffer, as the extra cost of computing the transformations on the fly is low enough to be acceptable, which might not be the case with other functions).