About five months ago, the biggest update of Nvim comes with its v0.5.0 release. With v0.5, we finally get the official LSP support in Nvim core and better Lua support, among other features and bug fixes1.
TL;DR: My LSP-related config can be found here.
This Tuesday, the Nvim v0.6.0 version is released. During the five months, the LSP module has been revamped and enhanced, though with some breaking changes.
Below are some the changes we need or can make based on this release.
Diagnostics and LSP changes#
Initially, diagnostic module is part of vim.lsp module. In order to support
external plugins such as null-ls.nvim, the nvim team has refactor the
diagnostic module to its module vim.diagnostic. So we need to change our config accordingly.
vim.lsp.diagnostic.show_line_diagnostics()has been changed tovim.diagnostic.open_float(). Previously, there is no easy to show diagnostic source unless with some hack, you can now show source in diagnostics inopen_float()easily:vim.diagnostic.open_float(nil, { source = 'always' })vim.lsp.diagnostic.goto_prev()andvim.lsp.diagnostic.goto_next()has been renamed tovim.diagnostic.goto_prev()andvim.diagnostic.goto_next()respectively.vim.lsp.diagnostic.set_loclist()andvim.lsp.diagnostic.set_qflist()has been renamed tovim.diagnostic.setloclist()andvim.diagnostic.setqflist()instead.Diagnostics signs has been renamed, for example (old –> new):
LspDiagnosticsSignError–>DiagnosticSignError(Lspis removed,Diagnosticsis changed to singular fromDiagnostic)LspDiagnosticsSignWarning–>DiagnosticSignWarnLspDiagnosticsSignInformation–>DiagnosticSignInfoLspDiagnosticsSignHint–>DiagnosticSignHint
Also, related highlight has been renamed too:
DiagnosticsDefaultError–>DiagnosticSignErrorDiagnosticsDefaultWarning–>DiagnosticSignWarnDiagnosticsDefaultInformation–>DiagnosticSignInfoDiagnosticsDefaultHint–>DiagnosticSignHint
Now, we can use the following lua snippet to change diagnostic signs:
vim.fn.sign_define("DiagnosticSignError", { text = "✗", texthl = "DiagnosticSignError" }) vim.fn.sign_define("DiagnosticSignWarn", { text = "!", texthl = "DiagnosticSignWarn" }) vim.fn.sign_define("DiagnosticSignInformation", { text = "", texthl = "DiagnosticSignInfo" }) vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" })
For more details on diagnostic change, see this commit.
Changes to the default#
There are also changes to options and mappings that you might be interested.
Option default value changes:
backupdircan now be created automatically and double backslash is used, see this commit.- option
inccommandis set tonosplit set nojoinspacesby default
Mapping changes:
<C-L>now defaults tonohlsearchanddiffupdate, see this commit.- In normal mode,
Yis mapped toy$, see this commit, no need fornnoremap Y y$anymore.