Base configuration for Neovim. For those looking to make Neovim their new main editor. Here you'll find a popular combination of plugin to make your experience a little bit better.
A few things have been configured to resemble other modern text editors. You'll find a file explorer with tree style view, list open files in tabs, git integration and a terminal easy to toggle.
Autocompletion and "code intellisense" is provided by the LSP client built into Neovim. The following language servers are configured:
- tsserver
- eslint
- cssls
- html
Most of the code in this configuration is explained in this series:
- Build your first Neovim configuration in lua
- Neovim: Plugins to get started
- Setup nvim-lspconfig + nvim-cmp
- Neovim v0.8 or greater.
- git.
- A
C
compiler. Can begcc
,tcc
orzig
. - make, the build tool.
- tsserver. Typescript language server.
- vscode-langservers-extracted. Provides language servers for
eslint
,css
andhtml
. - nodejs. Javascript runtime. Required by the language servers.
- (optional) ripgrep. Improves project wide search speed.
- (optional) fd. Improves file search speed.
- (optional) A patched font to display icons. I hear nerdfonts has a good collection.
Here's the config compatible with v0.7.
-
Backup your existing configuration if you have one.
-
Create an
init.lua
file in your system. Use this command if you don't know the specific location of Neovim's configuration folder.
nvim --headless -c 'call mkdir(stdpath("config"), "p") | exe "edit" stdpath("config") . "/init.lua" | write | quit'
- Open your configuration file with Neovim.
nvim -c 'edit $MYVIMRC'
-
Copy the content of
init.lua
in this repository into your owninit.lua
. -
Next time you start Neovim all plugins will be downloaded automatically. After plugins are downloaded restart Neovim.
Your plugins will be installed in a separate directory from your configuration. The location of this directory depends on your operating system and environment variables, so you'll need to execute this command to know where that is.
nvim --headless -c 'echo stdpath("data") . "/lazy/lazy.nvim" | quit'
Leader key: Space
.
Mode | Key | Action |
---|---|---|
Normal | <leader>h |
Go to first non empty character in line. |
Normal | <leader>l |
Go to last non empty character in line. |
Normal | <leader>a |
Select all text. |
Normal | gy |
Copy selected text to clipboard. |
Normal | gp |
Paste clipboard content. |
Normal | <leader>w |
Save file. |
Normal | <leader>bq |
Close current buffer. |
Normal | <leader>bc |
Close current buffer while preserving the window layout. |
Normal | <leader>bl |
Go to last active buffer. |
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. |
Normal | <leader>e |
Open file explorer. |
Normal | <Ctrl-g> |
Toggle the builtin terminal. |
Normal | K |
Displays hover information about the symbol under the cursor. |
Normal | gd |
Jump to the definition. |
Normal | gD |
Jump to declaration. |
Normal | gi |
Lists all the implementations for the symbol under the cursor. |
Normal | go |
Jumps to the definition of the type symbol |
Normal | gr |
Lists all the references. |
Normal | gs |
Displays a function's signature information. |
Normal | <F2> |
Renames all references to the symbol under the cursor. |
Normal | <F3> |
Format code in current buffer. |
Normal | <F4> |
Selects a code action available at the current cursor position. |
Visual | <F4> |
Selects a code action available in the selected text. |
Normal | gl |
Show diagnostics in a floating window. |
Normal | [d |
Move to the previous diagnostic. |
Normal | ]d |
Move to the next diagnostic. |
Mode | Key | Action |
---|---|---|
Insert | <Up> |
Move to previous item. |
Insert | <Down> |
Move to next item. |
Insert | <Ctrl-p> |
Move to previous item. |
Insert | <Ctrl-n> |
Move to next item. |
Insert | <Ctrl-u> |
Scroll up in documentation window. |
Insert | <Ctrl-d> |
Scroll down in documentation window. |
Insert | <Ctrl-e> |
Cancel completion. |
Insert | <C-y> |
Confirm completion. |
Insert | <Enter> |
Confirm completion. |
Insert | <Ctrl-f> |
Go to next placeholder in snippet. |
Insert | <Ctrl-b> |
Go to previous placeholder in snippet. |
Insert | <Tab> |
If completion menu is open, go to next item. Else, open completion menu. |
Insert | <Shift-Tab> |
If completion menu is open, go to previous item. |
Name | Description |
---|---|
lazy.nvim | Plugin manager. |
tokyonight.nvim | Collection of colorscheme for Neovim. |
onedark.vim | Colorscheme based on Atom's default theme. |
monokai.nvim | Colorscheme based on Sublime text's default theme. |
darkplus.nvim | Colorscheme based on VS Code's default theme. |
nvim-web-devicons | Helper functions to show icons. |
lualine.nvim | Pretty statusline. |
bufferline.nvim | Pretty tabline. |
indent-blankline.nvim | Shows indent guides in current file. |
nvim-tree.lua | File explorer. |
telescope.nvim | Fuzzy finder. |
telescope-fzf-native.nvim | Extension for telescope. Allows fzf-like syntax in searches. |
gitsigns.nvim | Shows indicators in gutter based on file changes detected by git. |
vim-fugitive | Git integration into Neovim/Vim. |
nvim-treesitter | Configures treesitter parsers. Provides modules to manipulate code. |
nvim-treesitter-textobjects | Creates textobjects based on treesitter queries. |
Comment.nvim | Toggle comments. |
vim-surround | Add, remove, change "surroundings". |
targets.vim | Creates new textobjects. |
vim-repeat | Add "repeat" support for plugins. |
vim-bbye | Close buffers without closing the current window. |
plenary.nvim | Collection of modules. Used internaly by other plugins. |
toggleterm.nvim | Manage terminal windows easily. |
nvim-lspconfig | Quickstart configs for Neovim's LSP client. |
nvim-cmp | Autocompletion engine. |
cmp-buffer | nvim-cmp source. Suggest words in the current buffer. |
cmp-path | nvim-cmp source. Show suggestions based on file system paths. |
cmp_luasnip | nvim-cmp source. Show suggestions based on installed snippets. |
cmp-nvim-lsp | nvim-cmp source. Show suggestions based on LSP servers queries. |
LuaSnip | Snippet engine. |
friendly-snippets | Collection of snippets. |