0x00
nvim
即neovim
,对vim
架构进行了大调整,并可以使用lua
进行编写插件和配置,nvim
集成了LSP
尽管nvim
已经集成了很多功能,但对于新手和不愿意折腾的人来说还是太麻烦了,于是就有了nvimdots
,nvimdots
是一个集成nvim
常用功能和插件的开源项目,就好比oh-my-zsh
与zsh
的关系一样
0x01 准备
尽管 nvimdots
有安装脚本,但是还是有一些依赖需要手动安装
nvimdots wiki 里有相关的教程,按照教程基本没问题
不过nvim
还是需要手动安装,截至目前nvim
建议安装0.9
版本
nvim wiki有相关教程
0x02 安装
因为安装时大部分插件是从github
上下载的,因此国内用户需要自备梯子,并在安装时将梯子设为全局代理,否则大概率会安装失败
linux安装
if command -v curl >/dev/null 2>&1; then
bash -c "$(curl -fsSL https://raw.githubusercontent.com/ayamir/nvimdots/HEAD/scripts/install.sh)"
else
bash -c "$(wget -O- https://raw.githubusercontent.com/ayamir/nvimdots/HEAD/scripts/install.sh)"
fi
windows安装
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://raw.githubusercontent.com/ayamir/nvimdots/HEAD/scripts/install.ps1'))
0x03 配置
进入nvim
使用:Mason
管理LSP
,过打开文件后使用:LspInstall
可以安装或查看对应的LSP
clangd
的默认filetype
中包含proto
文件类型,但是在非C/C++
项目中使用proto
文件会一直提示报错,虽然没什么影响但是很碍眼,而clangd
又是默认安装的还卸载不掉,卸载后又会自动安装。因此使用的办法是修改clangd
的配置文件,使其不对proto
文件做出反应。
默认的clangd
中的filetype
是"c", "cpp", "objc", "objcpp", "cuda", "proto"
clangd.lua
因此我们需要删除proto
nvim ~/.config/nvim/lua/modules/configs/completion/servers/clangd.lua
在require("lspconfig").clangd.setup({...})
的里面加入
filetypes = { "c", "cpp", "objc", "objcpp", "cuda" },
One comment
字里行间流露出真挚的情感,让人感同身受,共鸣不已。