{ config, inputs, lib, pkgs, username, ... }: let cfg = config.modules.neovim; in { options.modules.neovim.enable = lib.mkEnableOption "neovim"; config = lib.mkIf cfg.enable { environment.sessionVariables = { EDITOR = "nvim"; }; home-manager.users.${username} = { 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') '' ]; theme = { enable = true; name = "catppuccin"; style = "frappe"; }; maps = { normal = { "t" = { action = "Neotree toggle"; silent = true; }; }; }; statusline.lualine = { enable = true; theme = "catppuccin"; }; lsp = { enable = true; lspSignature.enable = true; lspconfig.enable = true; formatOnSave = true; mappings = { addWorkspaceFolder = "wa"; codeAction = "a"; goToDeclaration = "gD"; goToDefinition = "gd"; hover = "K"; listImplementations = "gi"; listReferences = "gr"; listWorkspaceFolders = "wl"; nextDiagnostic = "k"; previousDiagnostic = "j"; openDiagnosticFloat = "e"; removeWorkspaceFolder = "wr"; renameSymbol = "r"; signatureHelp = ""; }; }; 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; visuals.nvimWebDevicons.enable = true; filetree.neo-tree = { enable = true; setupOpts = { git_status_async = true; }; }; telescope.enable = true; }; }; }; }; }