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

Ripgrep installed, but executing live_grep is not able to detect it.

Open sriramr98 opened this issue 1 year ago • 0 comments

Description

I have ripgrep installed. I used the checkhealth telescope command to see if telescope is able to detect ripgrep

Output of CheckHealth command Screenshot 2024-02-17 at 5 03 37 PM

Screenshot of Error Screenshot 2024-02-17 at 5 06 06 PM

Here's my telescope configuration

return {
	{
		"nvim-telescope/telescope-ui-select.nvim",
	},
	{
		"nvim-telescope/telescope.nvim",
		tag = "0.1.5",
		dependencies = { "nvim-lua/plenary.nvim" },
		config = function()
			local telescopeConfig = require("telescope.config")

			local vimgrep_arguments = { telescopeConfig.values.vimgrep_arguments.unpack }

			-- I want to search in hidden/dot files.
			table.insert(vimgrep_arguments, "--hidden")

			-- I don't want to search in the `.git` and `node_modules` directory.
			table.insert(vimgrep_arguments, "--glob")
			table.insert(vimgrep_arguments, "!**/.git/*")
			table.insert(vimgrep_arguments, "!**/node_modules/*")

			require("telescope").setup({
				extensions = {
					["ui-select"] = {
						require("telescope.themes").get_dropdown({}),
					},
				},
				defaults = {
					-- `hidden = true` is not supported in text grep commands.
					vimgrep_arguments = vimgrep_arguments,
				},
				pickers = {
					find_files = {
						-- `hidden = true` will still show the inside of `.git/` as it's not `.gitignore`d.
						find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" },
					},
				},
			})
			local builtin = require("telescope.builtin")
			vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Find Files" })
			vim.keymap.set("n", "<leader>fw", builtin.live_grep, { desc = "Search String in Files" })
			vim.keymap.set("n", "<leader>fg", builtin.git_files, { desc = "Open Git Files" })

			require("telescope").load_extension("ui-select")
		end,
	},
}

Neovim version

NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1700008891

Operating system and version

macOS 13.4

Telescope version / branch / rev

tag 0.1.5

checkhealth telescope

==============================================================================
telescope: require("telescope.health").check()

Checking for required plugins ~
- OK plenary installed.
- OK nvim-treesitter installed.

Checking external dependencies ~
- OK rg: found ripgrep 14.1.0
- OK fd: found fd 9.0.0

===== Installed extensions ===== ~

Telescope Extension: `lazygit` ~
- No healthcheck provided

Telescope Extension: `ui-select` ~
- No healthcheck provided

Steps to reproduce

  1. Install Neovim and add telescope as dependency
  2. Use the configuration from my description
  3. Install ripgrep
  4. Open Neovim and do <leader>fw

Expected behavior

Live Grep is supposed to work as expected

Actual behavior

Live Grep crashes with an error message saying ripgrep not installed

Minimal config

return {
	{
		"nvim-telescope/telescope-ui-select.nvim",
	},
	{
		"nvim-telescope/telescope.nvim",
		tag = "0.1.5",
		dependencies = { "nvim-lua/plenary.nvim" },
		config = function()
			local telescopeConfig = require("telescope.config")

			local vimgrep_arguments = { telescopeConfig.values.vimgrep_arguments.unpack }

			-- I want to search in hidden/dot files.
			table.insert(vimgrep_arguments, "--hidden")

			-- I don't want to search in the `.git` and `node_modules` directory.
			table.insert(vimgrep_arguments, "--glob")
			table.insert(vimgrep_arguments, "!**/.git/*")
			table.insert(vimgrep_arguments, "!**/node_modules/*")

			require("telescope").setup({
				extensions = {
					["ui-select"] = {
						require("telescope.themes").get_dropdown({}),
					},
				},
				defaults = {
					-- `hidden = true` is not supported in text grep commands.
					vimgrep_arguments = vimgrep_arguments,
				},
				pickers = {
					find_files = {
						-- `hidden = true` will still show the inside of `.git/` as it's not `.gitignore`d.
						find_command = { "rg", "--files", "--hidden", "--glob", "!**/.git/*" },
					},
				},
			})
			local builtin = require("telescope.builtin")
			vim.keymap.set("n", "<leader>ff", builtin.find_files, { desc = "Find Files" })
			vim.keymap.set("n", "<leader>fw", builtin.live_grep, { desc = "Search String in Files" })
			vim.keymap.set("n", "<leader>fg", builtin.git_files, { desc = "Open Git Files" })

			require("telescope").load_extension("ui-select")
		end,
	},
}

sriramr98 avatar Feb 17 '24 11:02 sriramr98