Lightweight configuration focused on providing "basic features" with little boilerplate. It includes better syntax highlight, a fuzzy finder and IDE-like features powered by Neovim's LSP client.
- Neovim v0.5.1 or greater.
- v0.11 is recommended
- git.
- tree-sitter CLI.
- A
Ccompiler. Can begcc,tccorzig. - A language server. Required to actually enable the "IDE-like" features.
- (optional) ripgrep. Improves project wide search speed.
- (optional) fd. Improves file search speed.
If you need a C compiler then zig is the easiest to install. It's available on winget, scoop and chocolatey. You can also find some links in the zig download page.
-
I recommend installing Neovim's latest stable version.
-
Backup your existing configuration if you have one.
-
Create an
init.luafile in your system.If you don't know the location of Neovim's configuration file use this command.
nvim --headless -c 'echo stdpath("config") . "/init.lua" . "\n"' -c 'quit'
Use whatever method you want to create the config folder and also an empty
init.luafile. -
Choose a configuration file from the configs directory and copy its content to your own
init.lua.- configs/stable.lua requires NVIM v0.11 or greater
- configs/nightly.lua targets NVIM v0.12, the current nightly version
You can check Neovim's version using this command.
nvim --version
If you need support for older Neovim versions:
- configs/v0-9.lua targets NVIM v0.10 and v0.9
- configs/v0-7.lua targets NVIM v0.8 and v0.7
- configs/v0-5.lua targets NVIM v0.6 and v0.5
-
Open Neovim, use the command
nvimin your terminal. When Neovim starts all plugins will be downloaded automatically.
Neovim comes with an interactive tutorial that teaches the basics of the editor. The estimated time of this tutorial is around 45 minutes. It will show you how to move around text, how to execute commands and of course how to quit Neovim. You can access the tutorial by executing this command in your terminal.
nvim +TutorI've also created a documentation site aimed at teaching the basic features of Neovim. Note that it is mostly about how to use Neovim as a text editor without plugins, but there is still some valuable information there:
This configuration was created using a scripting language called lua, I highly recommend that you learn the syntax of this language. Learn just enough to know what is valid. Here are a couple resources:
Next step is to get familiar with Neovim's lua api, so you can create your own keybindings and commands. Here are a couple of guides you can read:
They are external programs that provide IDE-like features to Neovim. If you want to know more about language servers watch this wonderful 5 minutes video: LSP explained.
To know what language servers are supported you need to go to nvim-lspconfig's documentation, in configs.md you'll find links and instruction on how to install them.
Once you have a language server available in your system you need to enable it. Here's an example using the language server for lua, lua_ls.
On Neovim v0.10 or lower you must use the "legacy setup" function.
require('lspconfig').lua_ls.setup({})On Neovim v0.11 or greater you can use the function vim.lsp.enable().
vim.lsp.enable('lua_ls')Tip
Copy the content of .luarc.json of this github repository into your own .luarc.json. This file should be located next to your init.lua. With it the language server for lua will provide basic support for Neovim's lua api.
To get a more accurate syntax highlight for your favorite language you need to download something called a "treesitter parser".
So inside this configuration there is a variable called ts_parsers, and initially it looks like this.
local ts_parsers = {'lua', 'vim', 'vimdoc', 'c', 'query'}That will be a list of parsers, and they will be installed automatically. You can add more languages to this list, but make sure is supported by the plugin nvim-treesitter.
I've left a link to nvim-treesitter's documentation inside each configuration file. That will take you to the list of supported languages of the version that will be installed.
Another way to see the list of supported languages is by using tab-completion in Neovim's command-line mode. In Neovim, enter command-line mode by typing :, write TSInstall, press space, and then press the tab key. Neovim will show you the completion menu with all the available parsers. Note that on Neovim v0.11 and greater treesitter features must be enabled manually, so even if you install a parser with the command :TSInstall that parser should be added to the variable ts_parsers.
Neovim versions below v0.11 will use mini.deps as the plugin manager. Make sure to read the documentation to learn how to add more plugins:
Neovim v0.12 and greater will use vim.pack, a builtin plugin manager currently under development.
Leader key: Space.
| Mode | Key | Action |
|---|---|---|
| Normal | gy |
Copy text to clipboard. |
| Normal | gp |
Paste text from clipboard. |
| Normal | K |
Displays hover information about the symbol under the cursor. |
| Normal | gd |
Jump to the definition. |
| Normal | gq |
Format code in current buffer. |
| Normal | gO |
Lists symbols in the current buffer. |
| Normal | <C-s> |
Displays a function's signature information. |
| Normal | gri |
Lists all the implementations for the symbol under the cursor. |
| Normal | grr |
Lists all the references. |
| Normal | grn |
Renames all references to the symbol under the cursor. |
| Normal | gra |
Selects a code action available at the current cursor position. |
| Normal | grd |
Jump to declaration. |
| Normal | grt |
Jumps to the definition of the type symbol |
| Normal | <Ctrl-w>d |
Show diagnostics in a floating window. |
| Normal | [d |
Move to the previous diagnostic. |
| Normal | ]d |
Move to the next diagnostic. |
| Normal | gcc |
Toggle comment in current line. |
| Operator | gc |
Toggle comment in text. |
| Operator | sa |
Add surrounding. |
| Normal | sd |
Delete surrounding. |
| Normal | sr |
Surround replace. |
| Normal | sf |
Find surrounding. |
| Normal | <leader>e |
Toggle file explorer. |
| Normal | <leader>bc |
Close current buffer and preserve window layout. |
| Normal | <leader>? |
Search oldfiles history. |
| Normal | <leader><space> |
Search open buffers. |
| Normal | <leader>ff |
Find file in current working directory. |
| Normal | <leader>fg |
Search pattern in current working directory. Interactive "grep search". |
| Normal | <leader>fd |
Search diagnostics in current file. |
| Normal | <leader>fs |
Search pattern in current file. |
| Mode | Key | Action |
|---|---|---|
| Insert | <Up> |
Move to previous item. |
| Insert | <Down> |
Move to next item. |
| Insert | <Ctrl-p> |
Move to previous item and insert content. |
| Insert | <Ctrl-n> |
Move to next item and insert content. |
| Insert | <Ctrl-y> |
Confirm completion. |
| Insert | <Enter> |
Confirm completion if item was selected with Up or Down arrows. |
| Insert | <Ctrl-e> |
Cancel completion. |
| Name | Description |
|---|---|
| tokyonight.nvim | Collection of colorscheme for Neovim. |
| which-key.nvim | Provide clues for keymaps. |
| mini.nvim | Collection of independent lua modules that enhance Neovim's features. |
| nvim-treesitter | Manage treesitter parsers and provide query files for the supported languages. |
| ts-enable.nvim | Enable treesitter based features (Neovim v0.11+ only). |
| nvim-lspconfig | Quickstart configs for Neovim's LSP client. |