A Neovim config based on ThePrimeagen's video 0 to LSP : Neovim RC From Scratch and the following series (Part 1, Part 2, Part 3). It offers a familiar IDE experience and has a simple structure, making it simple to add new plugins.
It's possible to install Neovim using your package manager, but be aware that Neovim may be upgraded to a newer version when you update your packages. Installing Neovim from the source code is necessary to ensure that it only updates when you want it to.
Make sure to remove or backup your current ~/.config/nvim
directory.
git clone --single-branch --branch main [email protected]:iktzdx/neovimrc.git ~/.config/nvim
Lazy is used as a plugin manager. Run the :Lazy
command to access the main menu.
Run nvim .
and wait for the plugins to be installed.
NOTE: You'll probably notice treesitter installing a bunch of parsers the next time you re-open Neovim.
Mason is used to install and manage LSP servers, DAP servers, linters, and formatters via the :Mason
command.
In order for Telescope to work, the following tools are required:
For Golang integration:
- SDK: Go
- Language server: gopls
- Debugger: delve
- Linters runner: golangci-lint
- LSP support (native LSP + nvim-lspconfig + mason + mason-lspconfig).
- Formatter (conform.nvim) and linters (nvim-lint).
- Git integration (gitsigns + vim-fugitive).
- Auto-completion (nvim-cmp) and code snippets (luasnip).
- Fuzzy find, live grep (telescope).
- Improved navigation (harpoon + leap).
- Debugging (nvim-dap + nvim-dap-go).
- Testing (neotest).
The main key mappings are listed in the file keymaps.lua.
The key mappings specific to plugins are placed in their corresponding configuration files (e.g. lua/user/plugins/category_name/plugin_name.lua
).
Here are a few of the most commonly used key mappings:
<leader>pf
— find file by name in the current project directory<leader>pv
— open netrw directory listinggd
— go to definition of the symbol under the cursorCtrl-o
— go to older position in jump listCtrl-i
— go to newer position in jump listK
— open man page for word under the cursor<leader>vrn
— rename the symbol under the cursor<leader>vca
— list all available code actions (fill struct, organize imports, etc.)<leader>imp
— list all the implementation of the word under the cursor<leader>ref
— list all the LSP references of the word under the cursor<leader>inc
— list all the LSP incoming calls of the word under the cursor<leader>dx
— list diagnostics for all open buffers]m
— move cursor to the beginning of the next method definition[m
— move cursor to the beginning of the previous method definition;
— repeat previous movement,
— repeat previous movement backwards%
— move cursor to matching character (default supported pairs: '()', '{}', '[]')Ctrl-p
— move to the previous item in the auto-completion menuCtrl-n
— move to the next item in the auto-completion menuCtrl-y
— select the current item in the auto-completion menu