telescope.nvim icon indicating copy to clipboard operation
telescope.nvim copied to clipboard

lsp_references, grep_string function highlight searching words

Open yueyingjuesha opened this issue 3 years ago • 7 comments

Is your feature request related to a problem? Please describe. Whenever I use telescope.builtin.lsp_references, telescope.builtin.grep_string, always find it difficult to see the word being searched, it would be great if we can highlight the string being searched in both results windows & grep preview window

Describe the solution you'd like highlight the string being searched in both results windows & grep preview window

Describe alternatives you've considered A clear and concise description of any alternative solutions or features you've considered.

Additional context Add any other context or screenshots about the feature request here.

yueyingjuesha avatar Sep 19 '21 23:09 yueyingjuesha

same issue here.

ssh352 avatar Jun 25 '22 07:06 ssh352

Same here

juanmagalhaes avatar Jul 03 '23 19:07 juanmagalhaes

Would be a great addition!

Iron-E avatar Jul 13 '23 20:07 Iron-E

I was able to hack this together by adding a slight delay and entering the search string once the search modal has popped up:

vim.api.nvim_create_user_command('Grep',
	function(opts)
		require("telescope.builtin").grep_string(
			{ search = opts.fargs[1], file_ignore_patterns = { ".git/" } }
		)
		vim.defer_fn(function()
			vim.api.nvim_put({ opts.fargs[1] .. " " }, 'c', true, true)
		end, 50)
	end,
	{ nargs = 1 }
)

MrGrinst avatar Aug 18 '23 14:08 MrGrinst

This is a theme issue. I just checked it works as expected in some themes like rose-pine.

What is the highlight group?

Avi-D-coder avatar May 09 '24 19:05 Avi-D-coder

I my case TelescopeNormal and Visual were set to the same background. TelescopePreviewLine links to Visual by default.

You can set TelescopePreviewLine to fix the issue.

Avi-D-coder avatar May 09 '24 20:05 Avi-D-coder

@Avi-D-coder I think the difference is highlighting the entire line of the match vs highlighting just the matched word.

For grep_string and live_grep, there needs to be a semi-major rewrite but this is in the works. https://github.com/nvim-telescope/telescope.nvim/pull/2536

For other pickers like for lsp_references, this would also require some non-trivial amount of work - this, there isn't any advancements on.

jamestrew avatar May 12 '24 02:05 jamestrew