0

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.

Boyd
  • 351
  • 4
  • 14
  • 'No idea what has happened.' - IdeA: The ```end``` is moved. From the first function where it should close ```M.dotfiles()``` to the end of the script. – koyaanisqatsi Dec 24 '22 at 20:59
  • 'This was actually working a few months back.' - Hm - Than better delete last ```end``` and use (copy'n'paste) a ```end``` from the other functions. Probably the last ```end``` has a strong mass and in a few month it happens again if you move the old ```end``` back to close the ```M.dotfiles()```. – koyaanisqatsi Dec 24 '22 at 21:14
  • arrg.... How did I not see that. Staring at it too long. Thanks. @koyaanisqatsi – Boyd Dec 25 '22 at 00:41

0 Answers0