惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

Recent Announcements
Recent Announcements
爱范儿
爱范儿
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
宝玉的分享
宝玉的分享
T
Tailwind CSS Blog
博客园_首页
IT之家
IT之家
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 三生石上(FineUI控件)
有赞技术团队
有赞技术团队
大猫的无限游戏
大猫的无限游戏
雷峰网
雷峰网
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
博客园 - 司徒正美
WordPress大学
WordPress大学
Last Week in AI
Last Week in AI
人人都是产品经理
人人都是产品经理
Jina AI
Jina AI
月光博客
月光博客
小众软件
小众软件
S
SegmentFault 最新的问题
量子位
阮一峰的网络日志
阮一峰的网络日志
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知

jdhao's digital space

Conversion between base64 and OpenCV or PIL Image 腾讯云对象存储博客图床开启 CDN 加速(不需要购买额外域名) Search and Replace in Multiple Files in Vim/Neovim Change Table Column Width in LaTeX Image or Table Side by Side in LaTeX LaTeX 并排显示图像或表格 Firenvim: Neovim inside Your Browser Content inside HTML tags missing in Latest Hugo? Creating Markdown Front Matter with Ultisnips Labelme JSON 标注格式转 voc XML 格式 Nifty Nvim Techniques That Make My Life Easier -- Series 6 macOS 下如何为视频制作字幕 Running Command Asynchronously inside Neovim Resolving Merge Conflict after Git Stash Pop Pylint: command not found? A Hands-on Experience with Neovim's Built-in LSP Support How to Convert PDF to Images with Imagemagick 互联网上常用缩略语集锦 File Backup in Neovim Converting PDF Pages to Images with Poppler Nifty Nvim Techniques That Make My Life Easier -- Series 5 Neovim Configuration for System-wide Use How to sort a list of tuple or list in Python -- lambda or itemgetter? Building A Vim Statusline from Scratch 人类第一颗原子弹爆炸始末 Distributed Training in PyTorch with Horovod Learning Expect Programming Essential Knowledge about SSH Nifty LaTeX Techniques -- Series 1 更改 Adsense 邮寄地址,重新寄送 PIN
Migration from Nvim 0.5.1 to Nvim 0.6.0
2021-12-01 · via jdhao's digital space

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.

  1. vim.lsp.diagnostic.show_line_diagnostics() has been changed to vim.diagnostic.open_float(). Previously, there is no easy to show diagnostic source unless with some hack, you can now show source in diagnostics in open_float() easily:

    vim.diagnostic.open_float(nil, {
        source = 'always'
    })
  2. vim.lsp.diagnostic.goto_prev() and vim.lsp.diagnostic.goto_next() has been renamed to vim.diagnostic.goto_prev() and vim.diagnostic.goto_next() respectively.

  3. vim.lsp.diagnostic.set_loclist() and vim.lsp.diagnostic.set_qflist() has been renamed to vim.diagnostic.setloclist() and vim.diagnostic.setqflist() instead.

  4. Diagnostics signs has been renamed, for example (old –> new):

    • LspDiagnosticsSignError –> DiagnosticSignError (Lsp is removed, Diagnostics is changed to singular from Diagnostic)
    • LspDiagnosticsSignWarning –> DiagnosticSignWarn
    • LspDiagnosticsSignInformation –> DiagnosticSignInfo
    • LspDiagnosticsSignHint –> DiagnosticSignHint

    Also, related highlight has been renamed too:

    • DiagnosticsDefaultError –> DiagnosticSignError
    • DiagnosticsDefaultWarning –> DiagnosticSignWarn
    • DiagnosticsDefaultInformation –> DiagnosticSignInfo
    • DiagnosticsDefaultHint –> 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:

  • backupdir can now be created automatically and double backslash is used, see this commit.
  • option inccommand is set to nosplit
  • set nojoinspaces by default

Mapping changes:

  • <C-L> now defaults to nohlsearch and diffupdate, see this commit.
  • In normal mode, Y is mapped to y$, see this commit, no need for nnoremap Y y$ anymore.