search_dirs argument not working?
awillats opened this issue ยท 9 comments
This extension accepts the same options as builtin.live_grep, check out :help live_grep and :help vimgrep_arguments for more information.
using default live_grep
:
:Telescope live_grep search_dirs={"%:p"}
restricts the search to the current buffer. This is handy to replicate current_buffer_fuzzy_find
but with ripgrep instead (see Live grep current buffer and fuzzy find in cwd #762)
However, passing search_dirs={"%:p"}
to live_grep_args
:
:Telescope live_grep_args search_dirs={"%:p"}
seems to have no effect on the directories grep searches. (also worth noting other search_dirs={...}
options had no effect either).
I think there's probably still some way to achieve the same effect with ripgrep's flags directly, but I wonder whether any other arguments aren't being passed through to live_grep_args
that are available in live_grep
Update: i couldn't figure out how to accomplish this with the ripgrep flags without typing out the full path of the current file.
From a quick scan around I think the relevant sections of code are
v.s.
Not sure how exactly these links should help solve this problem?
These links highlight how telescope handles arguments to live_grep v.s. how live-grep-args handles arguments. Notably, telescope has logic for handling search_dirs that is missing from the live-grep-args version. I would propose using the telescope implementation as a guide to patch this back into live-grep-args
I'm also running into this issue, would love a fix!
Can someone give #48 a try?
Can someone give #48 a try?
I tried this branch in conjunction with the neoscopes plugin, it seems to work fine. Thanks for this improvement!
I tried switching from live_grep to live_grep_args for all my (manually) configured search scopes today and it didn't work because of this issue. I just tried #48 locally and it fixes the issue for me as well.
@mrmarkwell the PR that enables the search_dir
function has just been merged. Pull the latest update.
As of 0f75ea8, the search_dirs
options seem not working for shortcuts functions, i.e., grep_word_under_cursor
and grep_visual_selection
since the opts are hard coded. hope that search_dirs
would also work for them.