neovim

文档

安装 neovim

# homebrew
brew install neovim
nvim -v
nvim -V1 -v

安装 lazyvim

# github
git clone https://github.com/LazyVim/starter ~/.config/nvim
# ghfast.top
# https://ghproxy.link
git clone https://ghfast.top/https://github.com/LazyVim/starter ~/.config/nvim

初始化 lazyvim

# 重新运行 nvim
# 全局配置 GitHub 代理:git config --global url."https://ghfast.top/https://github.com/".insteadOf "https://github.com/"
# 取消配置 GitHub 代理:git config --global --unset url.https://ghfast.top/https://github.com/.insteadof

nvim

# 安装失败时,可重试安装
# 初始化失败
rm -rf ~/.local/share/nvim/lazy/lazy.nvim

下载字体

  1. 下载字体 0xProto 字体
  2. 安装带有 0xProto Mono 的字体,避免乱码
  3. 终端字体 修改为 0xProto Mono

安装 LSP 语法提示

# 打开 nvim
nvim
# 按 x 快捷键进入插件管理页面
x
# 按 x 启用/禁用插件
# 重新打开自动安装
x

命令

命令 说明
nvim 打开 neovim
nvim . 打开 当前文件夹
neo-tree 命令 说明
h 回到顶部
j 向下
k 向上
l 打开/关闭文件夹
tab 选中文件(夹)
Shift + h 显示/隐藏文件(夹)
q 关闭树
r 带搜索/预览功能的文件列表
neovim 内部命令 说明
h
j
k
l
Control + h neo-treeneovim 切换
Control + l 进入 neovim
Shift + h 向前切换已打开的文件
Shift + l 向后切换已打开的文件
空格 打开 Which Key,提示后续命令
空格 b d 关闭文件(Buffer
v 打开 选择,提示后续命令
d 打开 删除,提示后续命令
i 编辑模式
esc 退出编辑模式,进入普通模式
: 进入命令
: q a 退出 neovim
Control + / 进入/退出命令行
数字 + j 向上跳转几行
数字 + j 向上跳转几行
w 光标按照单词向右跳转
b 光标按照单词向左跳转
q 退出