1. 主角: NeoVim
sudo apt install -y ninja-build gettext cmake unzip curl
sudo apt install -y universal-ctags cscope #函数跳转用到的依赖
git clone https://github.com/neovim/neovim.git --depth=1
cd neovim
make CMAKE_BUILD_TYPE=RelWithDebInfo
sudo make install
2. 配角1: Nerd Font 字体
#下载源码(约1G)安装字体
git clone https://github.com/ryanoasis/nerd-fonts.git --depth 1
cd nerd-fonts;
./install.sh #linux
./install.ps1 #windows#也可以自行搜索下面几个安装到 ~/.local/share/fonts
# 安装字体后,必须执行 fc-cache -f -v 以刷新字体缓存
https://www.nerdfonts.com/font-downloads
'Hack Nerd Font',
'FiraCode Nerd Font',
'MesloLGL Nerd Font',
'JetBrainsMono Nerd Font'# 命令行终端及VScode等编辑器,设置字体为“非Mono”的字体,如:
"editor.fontFamily": "monospace,'Hack Nerd Font','FiraCode Nerd Font','MesloLGL Nerd Font', 'JetBrainsMono Nerd Font'"
Make sure the nerd font you set doesn't end with Mono to prevent small icons.
Example : JetbrainsMono Nerd Font and not JetbrainsMono Nerd Font Mono
3. 配角2:插件(下面3个任选一个,看个人喜好)
NvChad (20.2k stars)
#安装教程 https://nvchad.com/docs/quickstart/install
git clone https://github.com/NvChad/NvChad ~/.config/nvim --depth 1 && nvim
:NvChadUpdate #更新#卸载
# Linux / Macos (unix)
rm -rf ~/.config/nvim
rm -rf ~/.local/share/nvim# Windows
rd -r ~\AppData\Local\nvim
rd -r ~\AppData\Local\nvim-data# 快捷键:
欢迎页面 :Nvdash
左侧文件树(导航) ctrl + n
不显示隐藏文件(夹) shift + h
只显示打开的文件 shift + b
选择根文件夹 ctrl + ]
文件夹展开/收缩 o
文件打开 o 或 回车
文件垂直打开 ctrl + v
文件关闭 空格 + x
窗口跳转 ctrl + H (或 J 或 K 或 L 上下左右)
窗口大小调整 ctrl + 方向键
LunarVim (16.4k stars): is an IDE layer for Neovim
LunarVim:几乎包含了一个IDE能用到的所有功能,用mason管理lsp
#安装稳定版本
LV_BRANCH='release-1.3/neovim-0.9' bash <(curl -s https://raw.githubusercontent.com/LunarVim/LunarVim/release-1.3/neovim-0.9/utils/installer/install.sh)
#安装最新开发版本
bash <(curl -s https://raw.githubusercontent.com/lunarvim/lunarvim/master/utils/installer/install.sh):LvimUpdate
:LvimSyncCorePlugins
:Tutor#卸载
bash ~/.local/share/lunarvim/lvim/utils/installer/uninstall.sh
rm -rf ~/.cache/lvim
rm -rf ~/.config/lvim
rm -rf ~/.local/bin/lvim
rm -rf ~/.local/share/lunarvim#快捷键
选择根文件夹 ctrl + ]
根文件夹上一级 gg回到根路径后,再按 l
文件关闭 空格 + c
SpaceVim (20.1k stars)
#安装指南:https://spacevim.org/cn/quick-start-guide/
curl -sLf https://spacevim.org/cn/install.sh | bash
4.快捷键
vim中有一个被称之为<leader>前缀键,一般设置为‘空格’
高亮当前单词 *
% 在{[()]}跳转
Ctrl+^ 可以在打开的文件间跳转
大写K 查看光标单词定义
gf goto file 查看文件
gd goto definition 查看定义
gl代码跳转后返回 ctrl + o
前进半页 ctrl + d 后退半页 ctrl + u
前进一页 ctrl + f 后退一页 ctrl + b