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 matched part in picker (like live_grep) #1

Closed
Shatur opened this issue Nov 7, 2021 · 8 comments
Closed

Highlight matched part in picker (like live_grep) #1

Shatur opened this issue Nov 7, 2021 · 8 comments

Comments

@Shatur
Copy link

Shatur commented Nov 7, 2021

First of all thank you a lot for the awesome plugin!
I have a suggestion. With live_grep the matched part is highlighted:
изображение
But this plugin doesn't do it:
изображение

Could we implement it?

@weeman1337
Copy link
Collaborator

We can use the --json option for rg.

NeoVIM 0.6 is going to offer an API to lua-cjson. Means I would enable highlighting only if this API is available.

@Shatur
Copy link
Author

Shatur commented Nov 14, 2021

Means I would enable highlighting only if this API is available.

Just use vim.fn.json_decode until 0.6. It will be slower, but will work.

@Shatur
Copy link
Author

Shatur commented Nov 14, 2021

We can use the --json option for rg.

But I talking only about highlighting of the matched part. It's already implemented in live_grep.

@weeman1337 weeman1337 changed the title Highlight matched part Highlight matched part in picker (like live_grep) Nov 14, 2021
@weeman1337
Copy link
Collaborator

I think now I got it :)

Can you give https://github.com/nvim-telescope/telescope-live-grep-raw.nvim/tree/feature-use-grep-sorter a try? It's using the default grep highlighter. Unfortunately it doesn't work if you run a more complex query. Utilising the JSON result for the sorter/previewer would be the best solution.

@Conni2461
Copy link
Member

branch looks good. Thats only a workaround in telescope cores live_grep right now. Move to json is the way to go but was impossible with vim.fn.json_* because we are in a fast context and cant call viml at this point in time. schedule would be bad as well. So we need a api-fast function and vim.json is exactly that

@Shatur
Copy link
Author

Shatur commented Nov 14, 2021

Can you give https://github.com/nvim-telescope/telescope-live-grep-raw.nvim/tree/feature-use-grep-sorter a try?

Thanks, just what I need!

Move to json is the way to go but was impossible with vim.fn.json_* because we are in a fast context and cant call viml at this point in time. schedule would be bad as well. So we need a api-fast function and vim.json is exactly that

Yeah... Hope 0.6 will be released soon.

@weeman1337
Copy link
Collaborator

weeman1337 commented Nov 16, 2021

Tested feature-use-grep-sorter for a couple of days. Works and merged to master.

I am going to create a new issue for the preview using rg --json (#4)

@ssh352
Copy link

ssh352 commented Jun 25, 2022

for reference: fzf Rg has no such issue

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

4 participants