需要 Neovim v0.12.x,版本过低无法使用;LSP 语言服务器需另用 npm 全局安装,否则补全不生效;需安装 Nerd Fonts 才能正常显示图标;覆盖前先备份原有 ~/.config/nvim

git clone https://github.com/brainfucksec/neovim-lua.git
cd neovim-lua/
cp -Rv nvim ~/.config/
nvimREADME 未说明
一套遵循 KISS 原则的 Neovim Lua 配置,内置 LSP 与常用插件,可直接使用或作为学习起点
用 Lua 编写的极简 Neovim 配置,遵循 KISS 原则,开箱即用,适合想要轻量 IDE 体验又不想折腾复杂配置的人。
核心能力
- 用 vim.pack 管理插件并自动同步
- 预置 lua_ls、pyright、clangd 等 LSP 配置
- 集成 nvim-cmp 补全与 LuaSnip 代码片段
- 内置 nvim-tree 文件树与 Tagbar 大纲
- 提供 OneDark、Kanagawa 等多套配色
容易踩的坑
暂无 release 数据(可能没有发版,或尚未同步)。
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Table of Contents
- Plugins
- Directory Tree
- Files and Settings
- Installation
- LSP Configuration
- Appearance
- Keymaps
- Configuration Check
- Screenshots
- Guides and Resources
- Other Neovim Lua Project
- Lua Resources
- Disclaimer
- Thanks to
Plugins
lualine.nvim - A blazing fast and easy to configure neovim statusline plugin written in pure lua.
nvim-lspconfig - A collection of common configurations for Neovim's built-in language server client
nvim-cmp - Auto completion plugin
LuaSnip - Snippet Engine for Neovim written in Lua
nvim-tree.lua - A File Explorer written In Lua
indentBlankline - Adds indentation guides to all lines (including empty lines)
nvim-autopairs - A super powerful autopairs for Neovim
Tagbar - A class outline viewer for Vim
gitsigns - Super fast git decorations implemented purely in lua/teal
nvim-treesitter - Nvim Treesitter configurations and abstraction layer
alpha-nvim - A fast and highly customizable greeter for neovim.
nvim-web-devicons - A Lua fork of vim-devicons
Directory Tree
${HOME}/.config/nvim

Files and Settings
/nvim
-
init.lua: Main configuration file that call
luamodules -
lua: The directory of
luamodules, these modules are called in theinit.luafile (see below).
See: neovim.io/doc/user/lua-guide/#_lua-modules
/nvim/lsp/
Path for LSP configs lsp/*.lua files. See: Lsp - CONFIG
/nvim/lua/config
-
autocmds.lua: Define autocommands with Lua APIs
-
colors.lua: Define Neovim and plugins color scheme
-
keymaps.lua: Keymaps configuration file, Neovim and plugins keymaps
-
lsp.lua: Load LSP modules
-
options.lua: General Neovim settings
-
pack.lua: Plugin manager configuration file
-
statusline.lua: Statusline configuration file
/nvim/lua/plugin
-
alpha-nvim.lua: Dashboard
-
indent-blankline.lua: Indent line
-
nvim-cmp.lua: Autocompletion settings
-
nvim-tree.lua: File manager settings
-
nvim-treesitter: Treesitter interface configuration
Installation
-
Install Neovim v0.12.x.
-
Install Nerd Fonts, (the font of the screenshots are
JetBrainsMono Nerd Font). -
Install Node.js - npm for download packages of LSP language servers, see: LSP Configuration.
-
Make a backup of your current
nvimfolder if necessary:
mv ~/.config/nvim ~/.config/nvim.backup
- Download neovim-lua with
gitand copy thenvimfolder in the${HOME}/.configdirectory:
git clone https://github.com/brainfucksec/neovim-lua.git
cd neovim-lua/
cp -Rv nvim ~/.config/
- Run Neovim and download/sync plugins with
vim.pack, see: Pack - Plugin Manager
nvim
LSP Configuration
- Install LSP language servers with
npm, see: LSP Default Language Servers
sudo npm install -g \
bash-language-server \
pyright \
vscode-langservers-extracted \
typescript typescript-language-server \
rust-analyzer
For Lua language server see:
- Install additional packages for C, C++ and Python:
C, C++:
Python:
- Open a code file matching one of the filetypes specified in the config with Neovim, and check that LSP is active with
:checkhealth vim.lspcommand.
LSP Default Language Servers
neovim-lua by default has the following language servers installed:
Lua - lua_ls
Bash - bashls
Python - pyright
C, C++ - clangd
HTML, CSS, JSON - vscode-langservers-extracted
JavaScript, TypeScript - ts_ls
Rust - rust_analyzer
See nvim-lspconfig #doc/LSP configs
Appearance
Available Colorschemes
Fonts: See: Installation
Icons: nvim-web-devicons
See: Screenshots
The color scheme (default: OneDark) is defined in the following file:
- Neovim UI - nvim/lua/core/colors.lua:
-- Color scheme setup before load:
require('onedark').setup({
-- color scheme settings here..
})
--[[
Load color scheme:
Note: The instruction to load the color scheme may vary depending on the
package.
See the README of the related color scheme (i.e. git package) for information,
Examples: require('color_scheme').setup{}, vim.cmd('color_scheme')
--]]
require('onedark').load()
Keymaps
These are the default keymaps, in the following shortcuts, the <leader> key is set up to , (comma) character, see: keymaps.lua.
| Shortcut | Mode | Description |
|---|---|---|
kk | Insert | Esc with kk |
<leader>c | Normal | Clear search highlights |
<F2> | Normal | Toggle Paste mode |
<leader>tk/th | Normal | Change split orientation (vertical/horizontal) |
<Ctrl> + {h,j,k,l} | Normal | Move around splits windows |
<leader>r | Normal | Reload configuration file |
<leader>s | Normal | Save file |
<leader>q | Normal | Save (close all windows) and exit from Neovim |
<Ctrl> + t | Normal | Open terminal (:Term) |
<Esc> | Terminal | Exit terminal |
<Ctrl> + n | Normal | Open NvimTree |
<leader>t | Normal | Open/Close Tagbar |
Configuration Check
- Open nvim and run command
checkhealth, you should not see any error in the output (except for the one related to the Python 2 interpreter if don't have it):
:checkhealth
See: help checkhealth

- You can also use the
startuptimeoption to read the nvim startup logs:
nvim --startuptime nvim-start.log
nvim nvim-start.log
See: :help startuptime
Screenshots
Note: Screenshots may be out of date compared to the actual setup.
OneDark Darker

OneDark Dark

OneDark Cool

OneDark Deep

Kanagawa Wave (lualine theme: palenight)

Kanagawa Dragon (lualine theme: seoul256)

Monokai (lualine theme: molokai)

Rosé Pine (lualine theme: nightfly)

vim.pack

Neovim Guides and Resources
Lua Resources
Neovim Lua Docs
Disclaimer
This setup is based on KISS principle, probably some concepts may not be valid for everyone. Then feel free to take what you need but don't install anything without checking first!
This setup is not a Framework but it is the configuration I use to work on Linux, it can be used by default as it can be a start point to understand how Neovim is structured and maybe improve this config. Is the base configuration I use, and it tries to stay as simple as possible, with each addition weighted along these lines.
Thanks to:
- All the contributors who helped improve this setup with their reports and advices and all the authors of the sources mentioned above.