nvim-telescope / telescope.nvim

Find, Filter, Preview, Pick. All lua, all the time.
MIT License
15.95k stars 838 forks source link

telescope works, but "Telescope" vim command is missing #3186

Closed holmanb closed 4 months ago

holmanb commented 4 months ago

Description

telescope "works", but :Telescope vim command and :h telescope are missing

Neovim version

$ nvim --version         
NVIM v0.10.0
Build type: Release
LuaJIT 2.1.1713484068
Run "nvim -V1 -v" for more info

Operating system and version

Ubuntu 24.04

Telescope version / branch / rev

0.1.8

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 14.1.0
- OK fd: found fd 8.3.2

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

Steps to reproduce

  1. Try using the vim Telescope command:

    :Telescope
    E492: Not an editor command: Telescope
  2. Try checking the help text

    :help telescope
    E149: Sorry, no help for telescope

Expected behavior

I expected the :Telescope command and :h telescope command to work.

Actual behavior

They did not work.

Minimal config

local root = vim.fn.fnamemodify("./.repro", ":p")

-- set stdpaths to use .repro
for _, name in ipairs { "config", "data", "state", "cache" } do
  vim.env[("XDG_%s_HOME"):format(name:upper())] = root .. "/" .. name
end

-- bootstrap lazy
local lazypath = root .. "/plugins/lazy.nvim"
if not vim.uv.fs_stat(lazypath) then
  vim.fn.system {
    "git",
    "clone",
    "--filter=blob:none",
    "https://github.com/folke/lazy.nvim.git",
    lazypath,
  }
end
vim.opt.runtimepath:prepend(lazypath)

-- install plugins
local plugins = {
  {
    "nvim-telescope/telescope.nvim",
    dependencies = {
      "nvim-lua/plenary.nvim",
    },
    config = function()
      -- ADD INIT.LUA SETTINGS THAT ARE _NECESSARY_ FOR REPRODUCING THE ISSUE
      require("telescope").setup {}
    end,
  },
}

require("lazy").setup(plugins, {
  root = root .. "/plugins",
})
jamestrew commented 4 months ago

This seems like a configuration/runtimepath issue. I'm not able to reproduce this. Have you tried the minimal config? You can save it somewhere and run it with nvim -u minimal.lua

holmanb commented 4 months ago

I missed that when filing the report. I'm not sure how to debug from here, since I don't use lazy and this reproduces with a really slim configuration. @jamestrew how can I debug a runtimepath issue?

My configuration is pretty slim:

local rocks_config = {
        rocks_path = vim.env.HOME .. "/.local/share/nvim/rocks",
}

vim.g.rocks_nvim = rocks_config

local luarocks_path = {
        vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?.lua"),
        vim.fs.joinpath(rocks_config.rocks_path, "share", "lua", "5.1", "?", "init.lua"),
}
package.path = package.path .. ";" .. table.concat(luarocks_path, ";")

local luarocks_cpath = {
        vim.fs.joinpath(rocks_config.rocks_path, "lib", "lua", "5.1", "?.so"),
        vim.fs.joinpath(rocks_config.rocks_path, "lib64", "lua", "5.1", "?.so"),
}
package.cpath = package.cpath .. ";" .. table.concat(luarocks_cpath, ";")

vim.opt.runtimepath:append(vim.fs.joinpath(rocks_config.rocks_path, "lib", "luarocks", "rocks-5.1", "*", "*"))
require("telescope").setup({})
local builtin = require("telescope.builtin")
local vim = vim
vim.keymap.set("n", "<leader>ff", builtin.find_files, {})
vim.keymap.set("n", "<leader>fg", builtin.live_grep, {})
vim.keymap.set("n", "<leader>fb", builtin.buffers, {})
vim.keymap.set("n", "<leader>fh", builtin.help_tags, {})
jamestrew commented 4 months ago

How/where is telescope installed? Make sure the telescope installation directory shows up in :lua =vim.opt.rtp:get(). As long as telescope shows up in the runtimepath, vim should source the plugin/telescope.lua file that creates the :Telescope command.