Skip to content

[Feature request] Highlight the regex matching part of the line in the candidates #1147

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
rieje opened this issue Aug 8, 2017 · 8 comments

Comments

@rieje
Copy link

rieje commented Aug 8, 2017

Similar to how there's (incremental) highlighting for candidates for Ivy/Counsel. For a specific example, I wanted to replace ag with ripgrep so I do a search in my init.el for "ag". Needless to say, I am getting tons of candidates. If the regex matching part of the string in each line is highlighted, it would be far easier to parse each line to see if it's what I'm looking for, rather than reading each line from left to right trying to find all instances of ag.

@abo-abo
Copy link
Owner

abo-abo commented Aug 8, 2017

There's highlighting in both places by default. Unless I misunderstood what you're saying.

@rieje
Copy link
Author

rieje commented Aug 8, 2017

Through trial and error it seems the following is the culprit:

(setq ivy-re-builders-alist
'((swiper . ivy--regex-plus)
(t . ivy--regex-ignore-order)))

Removing (t . ivy--regex-ignore-order) restores highlighting. Is this a bug or intended? Can I keep this setting and still have highlighting?

@abo-abo
Copy link
Owner

abo-abo commented Aug 9, 2017

It's a bug then. I only use ivy--regex-plus, so I prioritize fixing that. PRs welcome.

@rieje
Copy link
Author

rieje commented Aug 10, 2017

Actually, I just checked and it seems commenting out either (swiper . ivy--regex-plus) or (t . ivy--regex-ignore-order) restores the intended behavior and having both settings results in no highlighting, so it's not an issue with ivy--regex-ignore-order but something else (hopefully that makes it more of a priority :)).

@abo-abo
Copy link
Owner

abo-abo commented Aug 10, 2017

Please give me a reproducible scenario with emacs -Q.

@rieje
Copy link
Author

rieje commented Aug 11, 2017

With the following settings:

(use-package ivy
  :ensure t
  :config
  (ivy-mode 1)
  (setq ivy-re-builders-alist
        '((swiper . ivy--regex-plus)
          (t . ivy--regex-ignore-order)
          )))

Use swiper and search for a string. incremental highlighting is shown in the visible buffer, but there is no highlighting of any sort in the minibuffer.

@abo-abo
Copy link
Owner

abo-abo commented Aug 13, 2017

Thanks, please test.

@rieje
Copy link
Author

rieje commented Aug 13, 2017

Works now, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants