This is my personal Neovim configuration. It's designed for a smooth development experience across various programming languages and tools. It includes settings for general usability, language server protocol (LSP) integration, syntax highlighting, code completion, formatting, and various plugins.
The following configurations are not yet covered in this readme: .config/ghostty
and .config/fish
files.
- Plugin Management: Managed with Packer.nvim.
- UI Enhancements: Custom colorscheme, UI plugins like
vim-airline
,NERDTree
. - LSP & Autocompletion: LSP configuration for Go, R, Lua, Python, and other languages with nvim-cmp for autocompletion.
- Code Formatting & Linting: Integration with
formatter.nvim
andnvim-lint
for automatic code formatting and linting. - Syntax Highlighting: Powered by nvim-treesitter for robust syntax highlighting.
- File Navigation:
NERDTree
for file exploration andfzf
for fuzzy searching.
- Neovim 0.5+: Ensure you are using Neovim version 0.5 or later.
- Git: Required for plugin management via Packer.
This setup uses Packer.nvim for managing plugins. If you don't have Packer installed, the configuration will handle the installation automatically.
This configuration includes the following categories of plugins:
-
UI:
gruvbox
: A popular colorscheme.vim-airline
: A status line plugin for Neovim.vim-airline-themes
: Themes for vim-airline.ntpeters/vim-better-whitespace
: Highlights trailing whitespace.
-
Completion:
nvim-lspconfig
: LSP (Language Server Protocol) configurations.nvim-cmp
: Autocompletion framework.cmp-nvim-lsp
,cmp-buffer
,cmp-path
,cmp-cmdline
: Various completion sources for LSP, buffers, paths, and command-line.
-
Search:
fzf
: A command-line fuzzy finder.
-
Code:
nvim-treesitter
: Syntax highlighting and more.vim-go
: Go programming support.R.nvim
: R programming support.Comment.nvim
: Toggle comments.
-
Formatting & Linting:
formatter.nvim
: Code formatter for various languages.nvim-lint
: Linting support for different file types.
-
Not Covered; Installed Separate
ocamllsp
: LSP Managed Separatelua_ls
: LSP Managed Separategopls
: LSP Managed Separate (vim-go might do this now?)r_language_server
: LSP Managed Separatepyrite
: LSP Managed Separateruff
: LSP Managed Separate- Code Formatters Managed Separate, but configuration done through conform
The configuration supports LSP for multiple programming languages. Here's a quick rundown:
- Go:
gopls
LSP setup with formatting on save. - Python:
pyrite
andruff
for python language support. - R:
r_language_server
LSP for R - Lua: Using
lua_ls
for Lua LSP, with custom configurations for Neovim. - OCaml:
ocamllsp
for OCaml language support.
The configuration includes autocompletion using nvim-cmp
, with completion sources from:
- LSP servers
- Buffers
- File paths
- Command-line
Key mappings for autocompletion:
<C-Space>
: Trigger autocompletion.<CR>
: Confirm autocompletion.<TAB>
&&<S-TAB>
: cycle auto completion.
- Formatting: Auto-formatting is set up with
formatter.nvim
andnvim-lint
.- Go, Lua, and R files are formatted automatically on save.
- Users need to install ecosystem specific formatters
- Linting: Linting is powered by
nvim-lint
, with configurations for Lua files usingluacheck
.
The config automatically sets indentation rules based on file types. For example:
- Lua: 2 spaces (spaces enabled)
- Python: 4 spaces (spaces enabled)
- Makefiles: 4 spaces (tabs enabled)
- Go: 4 spaces (tabs enabled)
- r: 2 spaces (spaces enabled)
Several custom key mappings have been set up for quick access to various features:
-
File Navigation:
<leader>n
: Open NERDTree.<C-n>
: Toggle NERDTree.<C-f>
: Focus NERDTree on the current file.
-
LSP:
gd
: Go to definition.K
: Show hover info.gr
: Go to references.<leader>rn
: Rename symbol.
-
Diagnostic:
<leader>d
: Open diagnostic floating window.[d
and]d
: Navigate to previous and next diagnostic.
-
Window Management:
<C-h>
,<C-j>
,<C-k>
,<C-l>
: Move between split windows.<leader>h
,<leader>l
: Switch between buffers.
- Colors: Uses
gruvbox
as the primary color scheme withvim-airline
for the status line. - Fonts: The setup assumes you're using a terminal with support for true color (e.g.,
termguicolors
enabled).
- History:
500
lines of command history. - Autoread: Automatically read files when modified outside of Neovim.
- Line Numbers: Relative and absolute line numbers.
- Mouse: Enabled in normal and visual modes (
mouse = "nv"
).