Automatically select the word under cursor when invoking live grep
weiyshay opened this issue ยท 6 comments
Hi,
Thanks for this nice plugin!
It is common to search for the word under cursor in case definition/reference is not helpful.
Very often the function/variable names are long and it is convenient if the plugin can have them selected when invoking live grep.
Also, it will be nice if a list of the history symbols searched can be prompted, is it possible?
@weeman1337 Thanks for your respone!
The original setting:
Open live_grep with current word under cursor
map('n', 'KD', function() live_grep_raw({default_text = vim.fn.expand("<cword>")}) end)
Yes, exactly. I did a quick try on the link but unfortunately it seems that the function changed and I could not make it.
i). name change from 'live_grep_raw' to 'live_grep_args', this is fine.
ii). The arguments changed from the pattern to search to an options which don't include a pattern due to ':help live_grep'
Error message:
E5108: Error executing lua vim/shared.lua:0: after the second argument: expected table, got string
stack traceback:
[C]: in function 'error'
vim/shared.lua: in function 'validate'
vim/shared.lua: in function 'tbl_extend'
...p-args.nvim/lua/telescope/_extensions/live_grep_args.lua:30: in function 'live_grep_args'
/root/.config/nvim/lua/wei-keymappings.lua:36: in function 'get_cur_word'
Any tips to work around?
This has net yet been merged โ reopen until then
okay.