An overview of a somewhat minimal neovim configuration for programming. This config came as a product from working with Flutter. Using NVF flake for cleaner integration of neovim inside NixOS.
Before explaining each section, nvf first needs to be enabled and neovim installed:
environment.systemPackages = [ pkgs.neovim ];
programs.nvf.enable = true;For clarity the rest of the blocks have can all be encapsulated within:
programs.nvf.settings.vim = {
};# Language servers
This setup uses LSPs for Dart and Nix.
Java, Python, Clang and the rest can be enabled in the same way Nvim-cmp is used for connecting the LSP with the autosuggestions
autocomplete.nvim-cmp.enable = true;
languages = {
enableTreesitter = true;
dart.enable = true;
nix.enable = true;
};
lsp = {
enable = true;
servers.dart.enable = lib.mkForce false;
};# Theming
- Transparent background This part is written natively in lua because NVF supports narrow range of colorschemes. Helper functions for listening on system-wide dark/light style changes
luaConfigPost = ''
vim.cmd.colorscheme("default")
vim.api.nvim_set_hl(0, "Normal", { bg = "NONE" })
vim.api.nvim_create_autocmd("ColorScheme", { callback = function()
vim.api.nvim_set_hl(0, "Normal", { bg = "NONE" })
end })
'';# Remaps
Find used for searching files Explore used for file navigation
maps.normal = {
"<leader>f" = { action = ":find **/*"; };
"<leader>e" = { action = ":Explore<CR>"; };
};# Other
Mostly options to disable visual stuff.
undoFile.enable = true;
options = {
mouse = "";
tabstop = 2;
shiftwidth = 2;
laststatus = 0;
number = false;
signcolumn = "auto";
relativenumber = false;
};# Usage
I’m mostly using commonly known vim motions, These might be less popular and provided by NVF:
lh - Hover la - Action lgd - Go definition lgi - Go implementations lgr - Go references le - Diagnostic ln - Rename
zz - Center line