Neovim 编辑器配置与使用
Neovim 是 Vim 的现代分支,支持 Lua 配置、异步插件、内置 LSP 客户端和终端。它兼容大部分 Vim 操作,但生态和配置方式不同。
nvim
nvim file.txt
nvim +':Telescope find_files'
nvim --headless "+Lazy! sync" +qa
nvim --headless "+checkhealth" +qa
nvim --version
~/.config/nvim/init.lua:
vim.opt.number = true
vim.opt.relativenumber = true
vim.opt.expandtab = true
vim.opt.shiftwidth = 2
vim.opt.termguicolors = true
vim.g.mapleader = " "
require("lazy").setup({
{ "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" } },
{ "neovim/nvim-lspconfig" },
{ "williamboman/mason.nvim", config = function() require("mason").setup() end },
})
常用命令:
:checkhealth
:Lazy
:Mason
:Telescope find_files
:LspInfo
:terminal
~/.config/nvim/init.lua(或 init.vim),不是 ~/.vimrc。 :checkhealth lsp 看缺失项。.gitignore 和限制目录。pbcopy/xclip)。nvim — 编辑器vim — 传统 Vimhelix — 另一种模态编辑器