Search code examples
neovimtelescope.nvim

Getting Telescope Error cannot run config "telescope.nvim" in Lazy vim


Keeps showing the error Failed to run config for telescope.nvim on mac os

Tried to run make in the native directory and still faced the same issue. Tried deleting the telescope-fzf-native.nvim file , didn't work

the directory for telescope files

  • ~/{user}/.local/share/nvim/lazy/telescope-fzf-native.nvim ~/{user}/.local/share/nvim/lazy/telescope.nvim

During first run it does already contain the build directory inside the telescope-fzf-native.nvim but it still had this error when I tried to :Lazy reload telescope.nvim

Failed to run `config` for telescope.nvim

{user}/.config/nvim/lua/sethy/plugins/telescope.lua:20: attempt to index global 'custom_actions' (a nil value)

# stacktrace:
  - lua/sethy/plugins/telescope.lua:20 _in_ **config**

This is the telescope.lua file I ran and got this error the directory for the file lua/sethy/plugins/telescope.lua

return {
  "nvim-telescope/telescope.nvim",
  branch = "0.1.x",
  dependencies = {
    "nvim-lua/plenary.nvim",
    { "nvim-telescope/telescope-fzf-native.nvim", build = "make" },
    "nvim-tree/nvim-web-devicons",
    
  },
  config = function()
    local telescope = require("telescope")
    local actions = require("telescope.actions")

  telescope.setup({
      defaults = {
        path_display = { "smart" },
        mappings = {
          i = {
            ["<C-k>"] = actions.move_selection_previous, -- move to prev result
            ["<C-j>"] = actions.move_selection_next, -- move to next result
            ["<C-q>"] = actions.send_selected_to_qflist + custom_actions.open_trouble_qflist,
            
          },
        },
      },
    })

    telescope.load_extension("fzf")

    -- set keymaps
    local keymap = vim.keymap 

    keymap.set("n", "<leader>ff", "<cmd>Telescope find_files<cr>", { desc = "Fuzzy find files in     cwd" })
    keymap.set("n", "<leader>fr", "<cmd>Telescope oldfiles<cr>", { desc = "Fuzzy find recent files" })
    keymap.set("n", "<leader>fs", "<cmd>Telescope live_grep<cr>", { desc = "Find string in cwd" })
    keymap.set("n", "<leader>fc", "<cmd>Telescope grep_string<cr>", { desc = "Find string under cursor in cwd" })
    
  end,
}





This is the health check

telescope: require("telescope.health") .check()
Checking for required plugins

- OK plenary installed.
- WARNING nvim-treesitter not found.

Checking external dependencies

 - 0K rg: found ripgrep 14.1.0
 - WARNING fd: not found. Install [sharkdp/fdl(https://github.com/sharkdp/fd) for extended capabilities
ニニニニ Installed extensions ニニニニニ
  • Also tried to run without build = "make", deleted the file and re do it also didn't work
  • I tried with run = "make" then later on force build it in :Lazy with gb also didn't work.
  • Tried in command shell to make into lazy/telescope-fzf-native.nvim directory in the terminal didn't work

All these seem to add a build directory to the file which was suppose to solve this issue from other posts Iv'e seen but doesn't seem to make any difference so Im thinking the issue may be from somewhere else where I can't see.

Anyone has any idea what went wrong


Solution

  •  ["<C-q>"] = actions.send_selected_to_qflist + custom_actions.open_trouble_qflist,
    

    Seems like the problem comes from there... Try deleting that line and see if it works