plugin/lsp.vim | 6 ++++-- diff --git a/plugin/lsp.vim b/plugin/lsp.vim index 9ece51bc347c25d832a124b841fca3c064a0998c..63cb3808e88074a6bdac4a25100cd5c5a979be96 100644 --- a/plugin/lsp.vim +++ b/plugin/lsp.vim @@ -17,8 +17,10 @@ endif augroup LSPAutoCmds au! - autocmd BufNewFile,BufReadPost * lsp#addFile(bufnr('%')) - autocmd BufWipeOut * lsp#removeFile(bufnr('%')) + autocmd BufNewFile,BufReadPost * lsp#addFile(expand('')->str2nr()) + # Note that when BufWipeOut is invoked, the current buffer may be different + # from the buffer getting wiped out. + autocmd BufWipeOut * lsp#removeFile(expand('')->str2nr()) if opt.lspOptions.showDiagOnStatusLine autocmd CursorMoved * lsp#showCurrentDiagInStatusLine() endif