error when calling lua custom search function in telescope

795 views Asked by At

I have telescope installed and functioning correctly. But when calling a custom telescope builtin I get the error:

E5108: Error executing lua [string ":lua"]:1: attempt to index a boolean value                                       
stack traceback:
        [string ":lua"]:1: in main chunk

I can type :Telescope live_grep and search file contents. I have tried to create a couple of customizations to search in a specific directory etc. I have even copied more than a couple of configs from the www. I have put for example the following in a file lua/config/telescope-custom.lua.

local M = {}

function M.dotfiles()
  require("telescope.builtin").find_files({
    prompt_title = "< config >",
    prompt_prefix = "",
    cwd = "$HOME/.config/",
  })

  function M.mandenkan()
    require("telescope.builtin").live_grep({
      cwd = "$HOME/Documents/Jula/search",
      prompt_title = "< mandenkan >",
      prompt_prefix = "",
      layout_strategy = "horizontal",
    })
  end

  function M.find_notes()
    require("telescope.builtin").find_files({
      prompt_title = " Find Notes",
      path_display = { "smart" },
      cwd = "~/notes/",
      layout_strategy = "horizontal",
      layout_config = { preview_width = 0.65, width = 0.75 },
    })
  end

  return M
end

But if I try to run this by typing :lua require'c._telescope-custom'.find_notes(), I get

E5108: Error executing lua [string ":lua"]:1: attempt to index a boolean value                                       
stack traceback:
        [string ":lua"]:1: in main chunk

I have tried putting the custom builtin functions at the end of the telescope.lua file with the same result.

What do I need to do to make this work?

NB: This was actually working a few months back. No idea what has happened.

0

There are 0 answers