flocon/modules/tui/neovim.nix

135 lines
3.4 KiB
Nix
Raw Normal View History

{
config,
inputs,
lib,
pkgs,
username,
...
2024-09-24 21:47:40 +00:00
}: let
cfg = config.modules.neovim;
2024-09-24 21:47:40 +00:00
in {
options.modules.neovim.enable = lib.mkEnableOption "neovim";
config = lib.mkIf cfg.enable {
environment.sessionVariables = {
EDITOR = "nvim";
};
home-manager.users.${username} = {
2024-09-24 21:47:40 +00:00
imports = [inputs.nvf.homeManagerModules.default];
programs.nvf = {
enable = true;
settings.vim = {
viAlias = true;
vimAlias = true;
enableLuaLoader = true;
preventJunkFiles = true;
tabWidth = 4;
autoIndent = false;
useSystemClipboard = true;
luaConfigPost = lib.concatStrings [
''
vim.opt.formatoptions:remove('c')
vim.opt.formatoptions:remove('r')
vim.opt.formatoptions:remove('o')
''
];
maps = {
normal = {
2024-09-24 21:47:40 +00:00
"<leader>m" = {
silent = true;
action = "<cmd>make<CR>";
}; # Same as nnoremap <leader>m <silent> <cmd>make<CR>
"<leader>t" = {
silent = true;
2024-09-24 21:47:40 +00:00
action = "<cmd>Neotree toggle<CR>";
};
};
};
2024-09-24 21:47:40 +00:00
theme = {
enable = true;
name = "catppuccin";
style = "frappe";
};
visuals = {
enable = true;
nvimWebDevicons.enable = true;
};
ui = {
noice.enable = true;
};
2024-09-24 22:01:27 +00:00
notify.nvim-notify.enable = true;
2024-09-24 21:47:40 +00:00
statusline.lualine = {
enable = true;
theme = "catppuccin";
};
2024-09-24 21:47:40 +00:00
git.enable = true;
lsp = {
enable = true;
lspSignature.enable = true;
lspconfig.enable = true;
formatOnSave = true;
mappings = {
addWorkspaceFolder = "<leader>wa";
codeAction = "<leader>a";
goToDeclaration = "gD";
goToDefinition = "gd";
hover = "K";
listImplementations = "gi";
listReferences = "gr";
listWorkspaceFolders = "<leader>wl";
nextDiagnostic = "<leader>k";
previousDiagnostic = "<leader>j";
openDiagnosticFloat = "<leader>e";
removeWorkspaceFolder = "<leader>wr";
renameSymbol = "<leader>r";
signatureHelp = "<C-k>";
};
};
autocomplete = {
enable = true;
alwaysComplete = true;
};
autopairs.enable = true;
languages = {
enableExtraDiagnostics = true;
enableFormat = true;
enableLSP = true;
enableTreesitter = true;
nix.enable = true;
clang.enable = true;
python.enable = true;
};
treesitter = {
enable = true;
fold = true;
context.enable = true;
grammars = [
pkgs.vimPlugins.nvim-treesitter.builtGrammars.nix
pkgs.vimPlugins.nvim-treesitter.builtGrammars.c
pkgs.vimPlugins.nvim-treesitter.builtGrammars.python
];
};
binds.whichKey.enable = true;
2024-09-24 21:47:40 +00:00
filetree.neo-tree.enable = true;
telescope.enable = true;
};
};
};
};
}