{ config, inputs, lib, pkgs, ... }: let cfg = config.myOptions.programs.neovim; inherit (config.myOptions.other.system) username; inherit (lib) mkEnableOption mkIf; in { options.myOptions.programs.neovim.enable = mkEnableOption "neovim"; config = mkIf cfg.enable { environment.sessionVariables = { EDITOR = "nvim"; }; home-manager.users.${username} = { imports = [ inputs.nvf.homeManagerModules.default ]; programs.nvf = { enable = true; settings.vim = { package = inputs.neovim-nightly-overlay.packages.${pkgs.system}.neovim; viAlias = false; vimAlias = false; enableLuaLoader = true; scrollOffset = 7; preventJunkFiles = true; tabWidth = 4; autoIndent = false; cmdHeight = 1; useSystemClipboard = false; theme = { enable = true; name = "catppuccin"; style = "mocha"; }; maps = { normal = { "v" = { action = "Neotree toggle"; silent = true; }; "m" = { action = "MarkdownPreviewToggle"; silent = true; }; }; terminal = { # get out of terminal mode in toggleterm "" = { action = ""; silent = true; }; }; }; statusline.lualine = { enable = true; theme = "catppuccin"; }; extraPlugins = with pkgs.vimPlugins; { zen-mode.package = zen-mode-nvim; unicode.package = unicode-vim; repolink = { package = pkgs.stdenv.mkDerivation { name = "repolink"; src = pkgs.fetchFromGitHub { owner = "9seconds"; repo = "repolink.nvim"; rev = "55edfedbaef3e894d2ab5107ea7fadc64cb8258d"; hash = "sha256-ykCswLzq38tO0GE4IB0dT3g239qkKpoW+d27sCorR90="; }; installPhase = '' runHook preInstall cp -r . $out runHook postInstall ''; }; setup = /*lua*/'' require("repolink").setup({ url_builders = { ["github"] = require("repolink").url_builder_for_github("https://github.com"), ["gitlab"] = require("repolink").url_builder_for_gitlab("https://gitlab.com"), ["codeberg"] = require("repolink").url_builder_for_gitea("https://codeberg.org"), ["jacekpoz"] = require("repolink").url_builder_for_gitea("https://git.jacekpoz.pl"), ["outfoxxed"] = require("repolink").url_builder_for_gitea("https://git.outfoxxed.me"), }, custom_url_parser = function(remote_url) local host, user, project = string.match( remote_url, "^([^:]+):([^/]+)/(.+)$" ) if host then return host, { user = user, project = project } end end }) ''; }; }; treesitter = { enable = true; fold = true; context.enable = true; }; autocomplete = { enable = true; alwaysComplete = false; }; filetree.neo-tree = { enable = true; }; terminal.toggleterm = { enable = true; setupOpts.direction = "tab"; mappings.open = ""; # TODO shading_factor # TODO shade_terminals # TODO size }; git = { enable = true; gitsigns = { enable = true; # TODO enable / disable all the settings }; }; lsp = { enable = true; lspSignature.enable = true; lspconfig.enable = true; mappings = { addWorkspaceFolder = "wa"; codeAction = "a"; format = ""; goToDeclaration = "gD"; goToDefinition = "gd"; hover = "K"; listImplementations = "gi"; listReferences = "gr"; listWorkspaceFolders = "wl"; nextDiagnostic = "k"; previousDiagnostic = "j"; openDiagnosticFloat = "e"; removeWorkspaceFolder = "wr"; renameSymbol = "r"; signatureHelp = ""; }; }; languages = { enableDAP = true; enableExtraDiagnostics = true; enableFormat = true; enableLSP = true; enableTreesitter = true; bash.enable = true; clang = { enable = true; cHeader = true; }; css.enable = true; html.enable = true; java.enable = true; markdown.enable = true; nix.enable = true; ocaml.enable = true; rust = { enable = true; crates.enable = true; }; ts.enable = true; }; utility = { motion.leap.enable = true; preview.markdownPreview.enable = true; # TODO settings.theme = "dark"; surround = { enable = true; useVendoredKeybindings = true; }; }; visuals.fidget-nvim.enable = true; # TODO laytan/cloak.nvim telescope.enable = true; comments.comment-nvim.enable = true; # TODO learn and add harpoon notes = { todo-comments = { enable = true; mappings.telescope = "tt"; setupOpts.highlight.pattern = ".*<(KEYWORDS)\s*"; }; orgmode = { enable = true; setupOpts = { org_agenda_files = [ "~/Notes/org" ]; org_default_notes_file = "~/Notes/org/refile.org"; }; treesitter.enable = true; }; }; }; }; }; }; }