Telescope bindings don't work.
Describe the bug
Just installed neovim and installed kickstart using readme as guide with no prior neovim config. Following through TJ's video "The Only Video You Need to Get Started with Neovim" and found that many of the default bindings appear to be broken.
To Reproduce
- Open
init.lua - Move cursor to
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences') - Press
gr
neovim is now waiting as if I had just hit r in normal mode. For example if I press a here it will change map to aap. Same issue occurs with other commands, gI moves the cursor to the start of the line and changes to insert mode.
Desktop
- OS: NixOS 23.11.6869.651b4702e27a (Tapir)
- Terminal: kitty 0.31.0
Neovim Version
NVIM v0.9.4
Build type: Release
LuaJIT 2.1.1693350652
Do other telescope bindings work for example <space><space> to get the list of buffers?
I suspect you have an issue with the lua_ls LSP. Can you run:
:LspInfo
You should get something like this:
Press q or <Esc> to close this window. Press <Tab> to view server doc.
Language client log: /home/.../.local/state/nvim/lsp.log
Detected filetype: lua
1 client(s) attached to this buffer:
Client: lua_ls (id: 1, bufnr: [1])
filetypes: lua
autostart: true
root directory: /home/...
cmd: /home/.../.local/share/nvim/mason/bin/lua-language-server
Configured servers list: lua_ls
Other things to check, :Mason should say:
Installed
◍ lua-language-server lua_ls
◍ stylua
and :checkhealth
vim.lsp: Active Clients ~
- lua_ls (id=1, root_dir=/home/...)
Yes actually, my bad. It seems to only be the keybindings defined inside the LspAttach autocmd, with the exception of gd which is the only one that works.
:LspInfo
Press q or <Esc> to close this window. Press <Tab> to view server doc.
Language client log: /home/<user>/.local/state/nvim/lsp.log
Detected filetype: lua
0 client(s) attached to this buffer:
Other clients that match the filetype: lua
Config: lua_ls
filetypes: lua
root directory: /home/<user>/.config/nvim
cmd: /home/<user>/.local/share/nvim/mason/bin/lua-language-server
cmd is executable: true
autostart: true
custom handlers:
Configured servers list: lua_ls
:Mason
Installed
◍ lua-language-server lua_ls
◍ stylua
:checkhealth
vim.lsp: require("vim.lsp.health").check()
- LSP log level : WARN
- Log path: /home/<user>/.local/state/nvim/lsp.log
- Log size: 2 KB
The log file just has a few lines saying the required file is not found.
Well there's your problem:
0 client(s) attached to this buffer:
As for why, I do not know, perhaps some NixOS peculiarity?
As far as I can tell it is not NixOS related but I only just started using the OS so I can't say for sure. I haven't used NixOS to manage any of Neovim's configuration at the moment, it is all done in the standard way.
Here is what was in the error logs mentioned in :checkhealth
[ERROR][2024-05-10 19:47:52] .../vim/lsp/rpc.lua:734 "rpc" "/home/<user>/.local/share/nvim/mason/bin/lua-language-server" "stderr" "/home/<user>/.local/share/nvim/mason/bin/lua-language-server: line 3: /home/<user>/.local/share/nvim/mason/packages/lua-language-server/libexec/bin/lua-language-server: cannot execute: required file not found\n"
If you check manually for that file is it there?
ls -l /home/*/.local/share/nvim/mason/packages/lua-language-server/libexec/bin/lua-language-server
-rwxr-x--x 1 user user 2288320 Jan 5 07:16 /home/user/.local/share/nvim/mason/packages/lua-language-server/libexec/bin/lua-language-server
You can try re-installing it, use :Mason then press X on lua-language-server which should uninstall it, then exit nvim and restart it and it should get reinstalled automatically. Then check if the above file is in its place.
Yes, file is there.
l .local/share/nvim/mason/packages/lua-language-server/libexec/bin/lua-language-server <user>@nixos
-rwxr-xr-x 1 <user> users 2.3M Apr 23 19:25 .local/share/nvim/mason/packages/lua-language-server/libexec/bin/lua-language-server
I'll try try reinstalling now.
Reinstalled and got the exact same behaviour.
I would say this is a NixOS specific issue.
Try checking this out:
Do any NixOS users here know a simlple way to get LSP working in Neovim?
https://www.reddit.com/r/NixOS/comments/1b5v5p8/do_any_nixos_users_here_know_a_simlple_way_to_get/
I've tried using neovim-unwrapped (instead of just neovim) in my configuration.nix but that didn't help. I primarily use Neovim to code so this is the only thing that is making me want to leave NixOS. I like a lot the features that NixOS has, but there are certain programs I just want to work with a minimal effort as possible. The problem I'm having is that certain binaries just won't work in NixOS when installed by a Neovim plugin like mason.nvim /home/user/.local/share/nvim/mason/bin/rust-analyzer To be clear, this is a NixOS specific issue. I've run my exact setup on Arch and I never had these issues
Interesting, I wonder what is stopping it from working when the files are all there. I'll see if I can work out some way to configure the LSP to still work without dropping kickstart. Thanks for pointing me in the right direction.
Closing this for now as it seems like this isn't a kickstart problem and we have no further action items.
Context: https://github.com/nvim-lua/kickstart.nvim/issues/930#issuecomment-2109822030
@dam9000 Sorry I cannot recreate this issue. I tested in Kitty as well but gr acts as it is supposed to for me.