nvim-telescope / telescope-live-grep-args.nvim

Live grep with args
727 stars 40 forks source link

Highlight matched part in picker (like live_grep) #1

Closed Shatur closed 2 years ago

Shatur commented 3 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

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 commented 2 years ago

for reference: fzf Rg has no such issue