Table of contents:
Welcome to my vanilla Neovim configuration. This is my attempt to create a functionality and minimal configuration without any extra plugins, which is inspired by this talk.
Important
Goals:
- Increase Neovim/Vim understanding.
- Offer powerful options.
- Challenge myself.
Not goals:
- Hate on plugins. On the contratry, I love them cause they make my Vim journey a lot easier. Checkout my daily configuration.
Features:
- Quickly comment/uncomment.
- Undo files.
- File browser.
- LSP!
- Blazing fast startup time (of course, it doesn't load any plugins 😌)
NVIM_APPNAME=nvim-vanilla vim-startuptime -vimpath nvim -count 100
Extra options: []
Measured: 100 times
Total Average: 16.576810 msec
Total Max: 50.683000 msec
Total Min: 8.702000 msec- Requirements:
- Install neovim >= 0.11.0, or you can build it yourself.
- Backup your current neovim config, if necessary:
mv ~/.config/nvim ~/.config/nvim.bak- Neovim's configurations are located under the following paths, depending on your OS:
| OS | PATH |
|---|---|
| Linux, MacOS | $XDG_CONFIG_HOME/nvim, ~/.config/nvim |
| Windows (cmd) | %localappdata%\nvim\ |
| Windows (powershell) | $env:LOCALAPPDATA\nvim\ |
- Fork this repo so that you have your own copy that you can modify, then install by cloning the fork to your machine using one of the commands below, depending on your OS.
Note
Your fork's url will be something like this:
https://github.com/<your_github_username>/vanilla-neovim.git
- Get your configuration:
Note
If following the recommended step above (i.e., forking the repo), replace
ntk148v with <your_github_username> in the commands below
Linux and Mac
git clone https://github.com/ntk148v/vanilla-neovim.git "${XDG_CONFIG_HOME:-$HOME/.config}"/nvimWindows
If you're using cmd.exe:
git clone https://github.com/ntk148v/vanilla-neovim.git "%localappdata%\nvim"If you're using powershell.exe
git clone https://github.com/ntk148v/vanilla-neovim.git "${env:LOCALAPPDATA}\nvim"- Start Neovim, Lazy should be installed automatically, then it will install plugins.
nvim- Restart Neovim and enjoy it. If you want to use LSP feature, it requires extra installation. Checkout [3. LSP].
- Keep updated: You should keep updated using
git pull.
Nvim supports the Language Server Protocol (LSP), which means it acts as a client to LSP servers and includes a Lua framework vim.lsp for building enhanced LSP tools.
LSP facilitates features like go-to-definition, find references, hover, completion, rename, format, refactor, etc., using semantic whole-project analysis (unlike ctags).
Nvim provides an LSP client, but the servers are provided by third parties. Follow these steps to get LSP features:
- Install language servers using your package manager or by following the upstream instructions: https://microsoft.github.io/language-server-protocol/implementors/servers/. I use these following language servers.
go install golang.org/x/tools/gopls@latest
npm install -g yaml-language-server
npm install -g pyright
npm install -g vscode-langservers-extracted-
Restart Nvim, or use ":edit" to reload the buffer.
-
Check that LSP is active ("attached") for the buffer:
:checkhealth vim.lsp
Read more about LSP in the official documentation.
Note
Work in progress
Hmm, you can figure out with the :map command. There are also other variants.
:nmapfor normal mode mappings:vmapfor visual mode mappings:imapfor insert mode mappings