nerdtree
nerdtree copied to clipboard
Error while using nvim's vim.lsp.buf.references()
Environment
- Operating System: macOS 12.1 (21C52)
- Vim/Neovim version
:version
: nvim v0.6.0 - NERDTree version, found on first line of quickhelp
?
: 6.10.16 - Are you using any of these NERDTree-dependent plugins?: None
- Provide a minimal .vimrc file that will reproduce the issue.
Plug 'scrooloose/nerdtree', { 'tag': '6.10.16' }
Plug 'neovim/nvim-lspconfig', { 'tag': 'v0.1.1'}
nnoremap <C-m> :NERDTreeFind<CR>
lua << EOF
local nvim_lsp = require('lspconfig')
local on_attach = function(client, bufnr)
local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end
local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end
local opts = { noremap=true, silent=true }
buf_set_keymap('n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts)
end
local servers = { 'tsserver', 'gopls' }
for _, lsp in ipairs(servers) do
nvim_lsp[lsp].setup {
on_attach = on_attach,
flags = {
debounce_text_changes = 150,
}
}
end
EOF
Steps to Reproduce the Issue
- Install
scrooloose/nerdtree
andneovim/nvim-lspconfig
- Select a function which is used elsewhere
- Call
<cmd>lua vim.lsp.buf.references()<CR>
(based on my setup, pressgr
) more info - Select a references
Current Behavior (Include screenshots where appropriate.)
The error is shown:
NERDTree: no file for the current buffer
Expected Result
Open up the reference in the current buffer. (and it does open, if I remove nerdtree)
Notes:
I found that nnoremap <C-m> :NERDTreeFind<CR>
is breaking it. If I remove that - everything works just fine.