Module telescope.builtin not found
Description
I'm getting an error in neovim that wasn't here before. Has anything changed about the configuration of telescope ?
Here's my current configuration :
return {
'nvim-telescope/telescope.nvim',
dependencies = { { 'nvim-lua/plenary.nvim' } },
keys = {
{ '<leader>tf', require('telescope.builtin').find_files, mode = 'n', desc = 'Find files' },
{ '<leader>ts', require('telescope.builtin').live_grep, mode = 'n', desc = 'Live grep' },
{ '<leader>tb', require('telescope.builtin').buffers, mode = 'n', desc = 'List buffers' },
{ '<leader>tr', require('telescope.builtin').resume, mode = 'n', desc = 'Resume picker' },
{ '<leader>to', ':Telescope aerial<CR>', mode = 'n', desc = 'Find outline' },
},
extensions = {
'aerial',
'fzf'
},
config = function()
require('telescope').load_extension('aerial')
end
}
I've tried setting the keys with vim.keymap.set inside the config function, and it works.
Neovim version
NVIM v0.11.2
Build type: RelWithDebInfo
LuaJIT 2.1.1748459687
Operating system and version
Linux
Telescope version / branch / rev
master
checkhealth telescope
==============================================================================
telescope: ✅
Checking for required plugins ~
- ✅ OK plenary installed.
- ✅ OK nvim-treesitter installed.
Checking external dependencies ~
- ✅ OK rg: found ripgrep 14.1.1
- ✅ OK fd: found fd 10.2.0
===== Installed extensions ===== ~
Telescope Extension: `aerial` ~
- No healthcheck provided
Telescope Extension: `session-lens` ~
- No healthcheck provided
==============================================================================
Steps to reproduce
- Put my config file in neovim config.
- Launch neovim.
Expected behavior
There's no error and telescope is loaded correctly.
Actual behavior
There's an error and Telescope is not loaded.
Minimal config
return {
'nvim-telescope/telescope.nvim',
dependencies = { { 'nvim-lua/plenary.nvim' } },
keys = {
{ '<leader>tf', require('telescope.builtin').find_files, mode = 'n', desc = 'Find files' },
{ '<leader>ts', require('telescope.builtin').live_grep, mode = 'n', desc = 'Live grep' },
{ '<leader>tb', require('telescope.builtin').buffers, mode = 'n', desc = 'List buffers' },
{ '<leader>tr', require('telescope.builtin').resume, mode = 'n', desc = 'Resume picker' },
{ '<leader>to', ':Telescope aerial<CR>', mode = 'n', desc = 'Find outline' },
},
extensions = {
'aerial',
'fzf'
},
config = function()
require('telescope').load_extension('aerial')
end
}
lazy calls require('telescope.builtin').x before telescope is loaded and require call cannot find telescope in your runtime path.
You can either pass a function to each mapping like
{ '<leader>tf', function() require('telescope.builtin').find_files() end, mode = 'n', desc = 'Find files' },
or wrap it in a string
{ '<leader>tf', "<cmd>lua require('telescope.builtin').find_files()<cr>", mode = 'n', desc = 'Find files' },
either one will defer the execution of require after lazy.nvim has loaded the plugin
I understand that, but why did it work before ?
I was installing telescope in my new environment and encountered this issue too. The function wrap solution works.
I have the same problem, but Termux. On Linux everything works fine.