Telescope find files and live grep not work

4.7k views Asked by At

I am trying to setup telescope with nvim on MacOS 13.2.1. I installed it using packer. I already installed all dependency that telescope needed. And still unable to show any result on find_files or live_grep search.

Here my config in packer for telescope

use({ "nvim-telescope/telescope.nvim", branch = "0.1.x", 
    requires = { { "nvim-lua/plenary.nvim" } } 
}) 

Here my telescope config

-- import telescope plugin safely
local telescope_setup, telescope = pcall(require, "telescope")
if not telescope_setup then
    return
end

-- import telescope actions safely
local actions_setup, actions = pcall(require, "telescope.actions")
if not actions_setup then
    return
end

-- configure telescope
telescope.setup({
    -- configure custom mappings
    defaults = {
        layout_config = {
            width = 0.75,
            prompt_position = "top",
            preview_cutoff = 120,
            horizontal = { mirror = false },
            vertical = { mirror = false },
        },

        find_command = {
            "rg",
            "--no-heading",
            "--with-filename",
            "--line-number",
            "--column",
            "--smart-case",
        },

        prompt_prefix = " ",
        selection_caret = " ",
        path_display = { "smart" },

        initial_mode = "insert",
        selection_strategy = "reset",
        sorting_strategy = "descending",
        layout_strategy = "horizontal",
        file_sorter = require("telescope.sorters").get_fuzzy_file,
        file_ignore_patterns = {},
        generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,

        winblend = 0,
        border = {},
        borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
        color_devicons = true,
        use_less = true,
        set_env = { ["COLORTERM"] = "truecolor" }, -- default = nil,
        file_previewer = require("telescope.previewers").vim_buffer_cat.new,
        grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
        qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
        buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,

        mappings = {
            i = {
                ["<C-j>"] = actions.move_selection_next, -- move to next result
                ["<C-k>"] = actions.move_selection_previous, -- move to prev result
                ["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist, -- send selected to quickfixlist
                ["<esc>"] = actions.close,
                ["<CR>"] = actions.select_default + actions.center,
            },
            n = {
                ["<C-j>"] = actions.move_selection_next,
                ["<C-k>"] = actions.move_selection_previous,
                ["<C-q>"] = actions.smart_send_to_qflist + actions.open_qflist,
            },
        },
    },
})

And here my :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 13.0.0
- OK fd: found fd 8.7.0

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

This is all of the nvim configuration, I don't know what I am missing, appreciate your help, thanks in advance.

I tried to reinstall ripgrep, and it still not showing any result

1

There are 1 answers

0
Damon Lee On

Suggested dependencies: "BurntSushi/ripgrep" is required for live_grep and grep_string and is the first priority for find_files.

To add the dependency "BurntSushi/ripgrep" to the packer file and download 'ripgrep' as the following:

sudo apt install ripgrep