Skip to content
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

Highlight search results in buffer with / #1733

Open
antoyo opened this issue Mar 3, 2022 · 9 comments
Open

Highlight search results in buffer with / #1733

antoyo opened this issue Mar 3, 2022 · 9 comments
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements

Comments

@antoyo
Copy link
Contributor

antoyo commented Mar 3, 2022

Hi.

Describe your feature request

I'd like an option to highlight the search results.
Thanks.

@antoyo antoyo added the C-enhancement Category: Improvements label Mar 3, 2022
@kirawi
Copy link
Member

kirawi commented Mar 3, 2022

I think this functionality was recently merged with #1635

@antoyo
Copy link
Contributor Author

antoyo commented Mar 3, 2022

That seems to only highlight the search results in the file picker.

I was talking about search in the buffer.

@kirawi kirawi added the A-helix-term Area: Helix term improvements label Mar 3, 2022
@archseer
Copy link
Member

archseer commented Mar 4, 2022

Search is selection based though, a way to see all the results would be to use vnnnnn to extend the selection with all matches then ( and ) to cycle the primary selection

@archseer
Copy link
Member

archseer commented Mar 4, 2022

You can also %s followed by search query to select all the matches.

@antoyo
Copy link
Contributor Author

antoyo commented Mar 4, 2022

That would produce a different behavior, though.

Kakoune supports it. For instance, you can create a search highlighter this way:

:addhl buffer/ dynregex '%reg{/}' 0:+u 1:+b

@xJonathanLEI
Copy link
Contributor

Just high-lighting all the search result is not exactly the same as selecting all of them (and hence... highlighting) though. I would like to loop through all the matches, and once I find the match I'm interested in, stop and make changes (ONLY to the current match), and then continue.

Having the next and previous matches highlighted helps me quickly navigate, as I can have a reasonable guess on where I would land before I even hit n (am I gonna jump to another function? or really just next line?). It saves a lot of mental effort trying to identify where I am, especially with the lack of smooth scrolling in terminal.

@mitsuhiko
Copy link
Contributor

I was trying to implement this but I believe with how the editor is currently internally structured it might be worthwhile to investigate first to have some sort of overlay abstraction in it. The most obvious way in which I can see this being implemented today would be quite wasteful as repeated edits/inserts would likely have to re-execute the search or manual booktracking of the overlays just for the search would be necessary.

@cemalokten
Copy link
Contributor

Just high-lighting all the search result is not exactly the same as selecting all of them (and hence... highlighting) though. I would like to loop through all the matches, and once I find the match I'm interested in, stop and make changes (ONLY to the current match), and then continue.

Having the next and previous matches highlighted helps me quickly navigate, as I can have a reasonable guess on where I would land before I even hit n (am I gonna jump to another function? or really just next line?). It saves a lot of mental effort trying to identify where I am, especially with the lack of smooth scrolling in terminal.

I totally agree, the ability to highlight all search results in the buffer would be incredibly useful, something I used to do in neovim all the time before switching to Helix.

@eguiraud
Copy link

Maybe easier now that virtual text #411 has been merged?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-helix-term Area: Helix term improvements C-enhancement Category: Improvements
Projects
None yet
Development

No branches or pull requests

7 participants