neovim

neovim

简介

mac

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## brew 安装neovim
brew install neovim/neovim/neovim
## neovim 开发版本的安装
brew tap neovim/neovim
brew install --HEAD neovim
## neovim安装稳定版本,不产生~/.nvimlog日志
brew install --HEAD --with-release neovim
brew update
brew reinstall --HEAD neovim

## 启动时间
nvim --startuptime ~/vimstart.log

配置

  • ~/.vim/init.vim
  • ~/.nvim/
  • ~/.nvim/lazy.nvim/
  • ~/.config/nvim/init.lua //默认加载配置文件
  • ~/.local/share/nvim/

字体

  • nerdfonts 下载 nerd 字体安装;
  • 设置终端字体为 nerd 字体;
  • 设置 gui 字体为 nerd 字体;
1
2
; vimrc
set guifont = Monaco\ Nerd\ Font\ Mono
1
2
-- init.lua
vim.o.guifont = "Monaco Nerd Font Mono"

常用命令

1
2
3
4
5
// 查看快捷键映射
: verbose map <C-p>

// 完整窗口查看帮助文档
: tab h lsp

lua

包管理

lazy.nvim

  • lazy.nvim 是包管理器, 支持懒加载;
1
2
## 无界面更新lazy
$ nvim --headless "+Lazy! sync" +qa

packer

packer 包管理

1
2
3
4
5
6
## 安装
$ git clone --depth 1 git@github.com:wbthomason/packer.nvim ~/.local/share/nvim/site/pack/packer/start/packer.nvim



curl -H User-Agent: nvim-lsp-installer (+https://github.com/williamboman/nvim-lsp-installer) -fsSL -o /Users/justice/.local/share/nvim/lsp_servers/rust_analyzer.tmp/rust-analyzer.gz https://github.com/rust-lang/rust-analyzer/releases/download/2022-05-09/rust-analyzer-x86_64-apple-darwin.gz

colorscheme

GUI

neovide

  • neovide 是用 rust 开发的 neovim GUI 客户端;
  • floaterm进入选择模式:<Ctrl-\><Ctrl-n>;

参考

  1. https://neovimcraft.com/
  2. Neovim: using vim-plug in lua - DEV Community
updatedupdated2024-08-252024-08-25