1

I want to use the find_command argument in Telescope's live_grep, as far as I know, it accepts a list of arguments that will be passed to ripgrep in this case.

This command works in the terminal:

rg -g "**/*.spec*" react-redux

So I want to setup a custom mapping that passes these arguments to live_grep like so:

x = {":Telescope live_grep find_command=rg,-g,'**/*.spec*'<cr>", "X Grep"},

However this is not working, it's searching without taking into consideration the glob passed.

Any ideas on how to solve this?

1 Answer 1

0

The live_grep function takes the vimgrep_arguments option in place of find_command, which is the option for the find_files function call. So:

vimgrep_arguments = {"rg", "-g", "**/*.spec*"}
require("telescope.builtin").live_grep({vimgrep_arguments = vimgrep_arguments})

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.