Lvim(Version: 1.2)环境搭建
LunarVim开发环境搭建官方网站
Prerequisites (Ubuntu 20.04.4)
- Neovim
wget https://github.com/neovim/neovim/releases/download/stable/nvim-linux64.tar.gz
- git
安装dnsutuils
sudo apt install dnsutils
#: nslookup github.com
Server: 100.100.2.136
Address: 100.100.2.136#53
Non-authoritative answer:
Name: github.com
Address: 20.205.243.166
#: nslookup github.global.ssl.fastly.net
Server: 100.100.2.136
Address: 100.100.2.136#53
Non-authoritative answer:
Name: github.global.ssl.fastly.net
Address: 108.160.172.232
Name: github.global.ssl.fastly.net
Address: 2a03:2880:f10f:83:face:b00c:0:25de
写入hosts文件
sudo vim /etc/hosts
添加内容
20.205.243.166 http://github.com
20.205.243.166 https://github.com
108.160.172.232 http://github.global.ssl.fastly.net
108.160.172.232 https://github.global.ssl.fastly.net
刷新缓存
sudo /etc/init.d/networking restart
- make
- python
- pip
sudo apt install python3-pip
mkdir ~/.pip
vim ~/.pip/pip.conf
添加如下内容
[global]
index-url = http://pypi.douban.com/simple/
[install]
trusted-host = pypi.douban.com
更新pip3
sudo pip3 install --upgrade pip
- node
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash -
sudo apt-get install -y nodejs
node --version
npm 加速
npm config set registry https://registry.npmmirror.com
npm config get registry
如果返回https://registry.npmmirror.com,说明镜像配置成功。
- rust
更改rust源,创建配置文件
mkdir ~/.cargo
vi ~/.cargo/config
添加文件内容
[source.crates-io]
replace-with = 'rsproxy'
[source.rsproxy]
registry = "https://rsproxy.cn/crates.io-index"
[registries.rsproxy]
index = "https://rsproxy.cn/crates.io-index"
[net]
git-fetch-with-cli = true
执行安装脚本
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source "$HOME/.cargo/env"
安装Lvim
LV_BRANCH='release-1.2/neovim-0.8' bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/fc6873809934917b470bff1b072171879899a36b/utils/installer/install.sh)
解决报错
[WARN]: skipping installing optional nodejs dependencies due to insufficient permissions.
check how to solve it: https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally
解决办法
mkdir ~/.npm-global
npm config set prefix '~/.npm-global'
export PATH=~/.npm-global/bin:$PATH
source ~/.profile
npm install -g jshint
添加自定义配置
lvim.format_on_save = true
vim.opt.tabstop = 4
vim.opt.mouse = ""
vim.opt.shiftwidth = 4
vim.opt.tabstop = 4
lvim.keys.normal_mode["<Tab>"] = ":bnext<cr>"
lvim.keys.normal_mode["<S-Tab>"] = ":bprev<cr>"
lvim.lsp.installer.setup.ensure_installed = {
"sumeko_lua",
"jsonls",
"clangd"
}
- 配置clangd
lvim .local/share/lunarvim/site/pack/packer/start/nvim-lspconfig/lua/lspconfig/server_configurations/clangd.lua
local root_files = {
'.clangd',
'.clang-tidy',
'.clang-format',
'compile_commands.json',
'compile_flags.txt',
'configure.ac', -- AutoTools
'../build/compile_commands.json' -- Cmake
}
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?