diff --git a/modules/plugins/assistant/copilot/copilot.nix b/modules/plugins/assistant/copilot/copilot.nix index 24c4286b..47da0699 100644 --- a/modules/plugins/assistant/copilot/copilot.nix +++ b/modules/plugins/assistant/copilot/copilot.nix @@ -8,6 +8,7 @@ inherit (lib.options) mkEnableOption mkOption; inherit (lib.types) nullOr str enum float; inherit (lib.nvim.types) mkPluginSetupOption; + inherit (config.vim.lib) mkMappingOption; cfg = config.vim.assistant.copilot; in { @@ -59,72 +60,19 @@ in { mappings = { panel = { - jumpPrev = mkOption { - type = nullOr str; - default = "[["; - description = "Jump to previous suggestion"; - }; - - jumpNext = mkOption { - type = nullOr str; - default = "]]"; - description = "Jump to next suggestion"; - }; - - accept = mkOption { - type = nullOr str; - default = ""; - description = "Accept suggestion"; - }; - - refresh = mkOption { - type = nullOr str; - default = "gr"; - description = "Refresh suggestions"; - }; - - open = mkOption { - type = nullOr str; - default = ""; - description = "Open suggestions"; - }; + jumpPrev = mkMappingOption "Jump to previous suggestion" "[["; + jumpNext = mkMappingOption "Jump to next suggestion" "]]"; + accept = mkMappingOption "Accept suggestion" ""; + refresh = mkMappingOption "Refresh suggestions" "gr"; + open = mkMappingOption "Open suggestions" ""; }; suggestion = { - accept = mkOption { - type = nullOr str; - default = ""; - description = "Accept suggestion"; - }; - - acceptWord = mkOption { - type = nullOr str; - default = null; - description = "Accept next word"; - }; - - acceptLine = mkOption { - type = nullOr str; - default = null; - description = "Accept next line"; - }; - - prev = mkOption { - type = nullOr str; - default = ""; - description = "Previous suggestion"; - }; - - next = mkOption { - type = nullOr str; - default = ""; - description = "Next suggestion"; - }; - - dismiss = mkOption { - type = nullOr str; - default = ""; - description = "Dismiss suggestion"; - }; + accept = mkMappingOption "Accept suggestion" ""; + acceptWord = mkMappingOption "Accept next word" null; + acceptLine = mkMappingOption "Accept next line" null; + prev = mkMappingOption "Previous suggestion" ""; + next = mkMappingOption "Next suggestion" ""; + dismiss = mkMappingOption "Dismiss suggestion" ""; }; }; }; diff --git a/modules/plugins/assistant/supermaven-nvim/supermaven-nvim.nix b/modules/plugins/assistant/supermaven-nvim/supermaven-nvim.nix index 0d1efd19..35346855 100644 --- a/modules/plugins/assistant/supermaven-nvim/supermaven-nvim.nix +++ b/modules/plugins/assistant/supermaven-nvim/supermaven-nvim.nix @@ -1,4 +1,8 @@ -{lib, ...}: let +{ + config, + lib, + ... +}: let inherit (lib.types) nullOr @@ -10,30 +14,16 @@ ; inherit (lib.options) mkOption mkEnableOption; inherit (lib.nvim.types) mkPluginSetupOption luaInline; + inherit (config.vim.lib) mkMappingOption; in { options.vim.assistant.supermaven-nvim = { enable = mkEnableOption "Supermaven AI assistant"; setupOpts = mkPluginSetupOption "Supermaven" { keymaps = { - accept_suggestion = mkOption { - type = nullOr str; - default = null; - example = ""; - description = "The key to accept a suggestion"; - }; - clear_suggestion = mkOption { - type = nullOr str; - default = null; - example = ""; - description = "The key to clear a suggestion"; - }; - accept_word = mkOption { - type = nullOr str; - default = null; - example = ""; - description = "The key to accept a word"; - }; + accept_suggestion = mkMappingOption "The key to accept a suggestion" null // {example = "";}; + clear_suggestion = mkMappingOption "The key to clear a suggestion" null // {example = "";}; + accept_word = mkMappingOption "The key to accept a word" null // {example = "";}; }; ignore_file = mkOption { type = nullOr (attrsOf bool); diff --git a/modules/plugins/filetree/nvimtree/nvimtree.nix b/modules/plugins/filetree/nvimtree/nvimtree.nix index c3beb38f..e3d36703 100644 --- a/modules/plugins/filetree/nvimtree/nvimtree.nix +++ b/modules/plugins/filetree/nvimtree/nvimtree.nix @@ -1,13 +1,15 @@ { + config, pkgs, lib, ... }: let inherit (lib.options) mkEnableOption mkOption literalExpression; inherit (lib.generators) mkLuaInline; - inherit (lib.types) nullOr str bool int submodule listOf enum oneOf attrs addCheck; + inherit (lib.types) str bool int submodule listOf enum oneOf attrs addCheck; inherit (lib.nvim.types) mkPluginSetupOption; inherit (lib.nvim.config) batchRenameOptions; + inherit (config.vim.lib) mkMappingOption; migrationTable = { disableNetrw = "disable_netrw"; @@ -76,26 +78,10 @@ in { enable = mkEnableOption "filetree via nvim-tree.lua"; mappings = { - toggle = mkOption { - type = nullOr str; - default = "t"; - description = "Toggle NvimTree"; - }; - refresh = mkOption { - type = nullOr str; - default = "tr"; - description = "Refresh NvimTree"; - }; - findFile = mkOption { - type = nullOr str; - default = "tg"; - description = "Find file in NvimTree"; - }; - focus = mkOption { - type = nullOr str; - default = "tf"; - description = "Focus NvimTree"; - }; + toggle = mkMappingOption "Toggle NvimTree" "t"; + refresh = mkMappingOption "Refresh NvimTree" "tr"; + findFile = mkMappingOption "Find file in NvimTree" "tg"; + focus = mkMappingOption "Focus NvimTree" "tf"; }; setupOpts = mkPluginSetupOption "Nvim Tree" { diff --git a/modules/plugins/lsp/module.nix b/modules/plugins/lsp/module.nix index 0f81d9a4..6b8f8640 100644 --- a/modules/plugins/lsp/module.nix +++ b/modules/plugins/lsp/module.nix @@ -14,66 +14,26 @@ in { }; mappings = { - goToDefinition = - mkMappingOption "Go to definition" - "lgd"; - goToDeclaration = - mkMappingOption "Go to declaration" - "lgD"; - goToType = - mkMappingOption "Go to type" - "lgt"; - listImplementations = - mkMappingOption "List implementations" - "lgi"; - listReferences = - mkMappingOption "List references" - "lgr"; - nextDiagnostic = - mkMappingOption "Go to next diagnostic" - "lgn"; - previousDiagnostic = - mkMappingOption "Go to previous diagnostic" - "lgp"; - openDiagnosticFloat = - mkMappingOption "Open diagnostic float" - "le"; - documentHighlight = - mkMappingOption "Document highlight" - "lH"; - listDocumentSymbols = - mkMappingOption "List document symbols" - "lS"; - addWorkspaceFolder = - mkMappingOption "Add workspace folder" - "lwa"; - removeWorkspaceFolder = - mkMappingOption "Remove workspace folder" - "lwr"; - listWorkspaceFolders = - mkMappingOption "List workspace folders" - "lwl"; - listWorkspaceSymbols = - mkMappingOption "List workspace symbols" - "lws"; - hover = - mkMappingOption "Trigger hover" - "lh"; - signatureHelp = - mkMappingOption "Signature help" - "ls"; - renameSymbol = - mkMappingOption "Rename symbol" - "ln"; - codeAction = - mkMappingOption "Code action" - "la"; - format = - mkMappingOption "Format" - "lf"; - toggleFormatOnSave = - mkMappingOption "Toggle format on save" - "ltf"; + goToDefinition = mkMappingOption "Go to definition" "lgd"; + goToDeclaration = mkMappingOption "Go to declaration" "lgD"; + goToType = mkMappingOption "Go to type" "lgt"; + listImplementations = mkMappingOption "List implementations" "lgi"; + listReferences = mkMappingOption "List references" "lgr"; + nextDiagnostic = mkMappingOption "Go to next diagnostic" "lgn"; + previousDiagnostic = mkMappingOption "Go to previous diagnostic" "lgp"; + openDiagnosticFloat = mkMappingOption "Open diagnostic float" "le"; + documentHighlight = mkMappingOption "Document highlight" "lH"; + listDocumentSymbols = mkMappingOption "List document symbols" "lS"; + addWorkspaceFolder = mkMappingOption "Add workspace folder" "lwa"; + removeWorkspaceFolder = mkMappingOption "Remove workspace folder" "lwr"; + listWorkspaceFolders = mkMappingOption "List workspace folders" "lwl"; + listWorkspaceSymbols = mkMappingOption "List workspace symbols" "lws"; + hover = mkMappingOption "Trigger hover" "lh"; + signatureHelp = mkMappingOption "Signature help" "ls"; + renameSymbol = mkMappingOption "Rename symbol" "ln"; + codeAction = mkMappingOption "Code action" "la"; + format = mkMappingOption "Format" "lf"; + toggleFormatOnSave = mkMappingOption "Toggle format on save" "ltf"; }; }; } diff --git a/modules/plugins/session/nvim-session-manager/nvim-session-manager.nix b/modules/plugins/session/nvim-session-manager/nvim-session-manager.nix index 8390d1ce..2dbfb654 100644 --- a/modules/plugins/session/nvim-session-manager/nvim-session-manager.nix +++ b/modules/plugins/session/nvim-session-manager/nvim-session-manager.nix @@ -1,10 +1,15 @@ -{lib, ...}: let +{ + config, + lib, + ... +}: let inherit (lib.options) mkOption mkEnableOption; inherit (lib.modules) mkRenamedOptionModule; inherit (lib.strings) isString; inherit (lib.types) nullOr str bool int enum listOf either; inherit (lib.generators) mkLuaInline; inherit (lib.nvim.types) luaInline mkPluginSetupOption; + inherit (config.vim.lib) mkMappingOption; in { imports = let renameSetupOpt = oldPath: newPath: @@ -26,29 +31,10 @@ in { enable = mkEnableOption "nvim-session-manager: manage sessions like folders in VSCode"; mappings = { - loadSession = mkOption { - type = nullOr str; - description = "Load session"; - default = "sl"; - }; - - deleteSession = mkOption { - type = nullOr str; - description = "Delete session"; - default = "sd"; - }; - - saveCurrentSession = mkOption { - type = nullOr str; - description = "Save current session"; - default = "sc"; - }; - - loadLastSession = mkOption { - type = nullOr str; - description = "Load last session"; - default = "slt"; - }; + loadSession = mkMappingOption "Load session" "sl"; + deleteSession = mkMappingOption "Delete session" "sd"; + saveCurrentSession = mkMappingOption "Save current session" "sc"; + loadLastSession = mkMappingOption "Load last session" "slt"; }; usePicker = mkOption { diff --git a/modules/plugins/terminal/toggleterm/toggleterm.nix b/modules/plugins/terminal/toggleterm/toggleterm.nix index 3e72954e..6b443b9e 100644 --- a/modules/plugins/terminal/toggleterm/toggleterm.nix +++ b/modules/plugins/terminal/toggleterm/toggleterm.nix @@ -5,7 +5,7 @@ ... }: let inherit (lib.options) mkOption mkEnableOption; - inherit (lib.types) nullOr str enum bool package either int; + inherit (lib.types) nullOr enum bool package either int; inherit (lib.modules) mkRenamedOptionModule; inherit (lib.nvim.types) mkPluginSetupOption luaInline; inherit (lib.generators) mkLuaInline; @@ -19,11 +19,7 @@ in { options.vim.terminal.toggleterm = { enable = mkEnableOption "toggleterm as a replacement to built-in terminal command"; mappings = { - open = mkOption { - type = nullOr str; - description = "The keymapping to open toggleterm"; - default = ""; - }; + open = mkMappingOption "Open toggleterm" ""; }; setupOpts = mkPluginSetupOption "ToggleTerm" { diff --git a/modules/plugins/ui/breadcrumbs/breadcrumbs.nix b/modules/plugins/ui/breadcrumbs/breadcrumbs.nix index 72351ecc..4769166b 100644 --- a/modules/plugins/ui/breadcrumbs/breadcrumbs.nix +++ b/modules/plugins/ui/breadcrumbs/breadcrumbs.nix @@ -7,6 +7,8 @@ inherit (lib.types) nullOr listOf enum bool str int; inherit (lib.modules) mkRenamedOptionModule; inherit (lib.nvim.types) mkPluginSetupOption borderType; + inherit (config.vim.lib) mkMappingOption; + mkSimpleIconOption = default: mkOption { inherit default; @@ -83,167 +85,33 @@ in { navbuddy = { enable = mkEnableOption "navbuddy LSP helper UI. Enabling this option automatically loads and enables nvim-navic"; mappings = { - close = mkOption { - type = str; - default = ""; - description = "Close and return the cursor to its original location."; - }; - - nextSibling = mkOption { - type = str; - default = "j"; - description = "Navigate to the next sibling node."; - }; - - previousSibling = mkOption { - type = str; - default = "k"; - description = "Navigate to the previous sibling node."; - }; - - parent = mkOption { - type = str; - default = "h"; - description = "Navigate to the parent node."; - }; - - children = mkOption { - type = str; - default = "l"; - description = "Navigate to the child node."; - }; - - root = mkOption { - type = str; - default = "0"; - description = "Navigate to the root node."; - }; - - visualName = mkOption { - type = str; - default = "v"; - description = "Select the name visually."; - }; - - visualScope = mkOption { - type = str; - default = "V"; - description = "Select the scope visually."; - }; - - yankName = mkOption { - type = str; - default = "y"; - description = "Yank the name to system clipboard."; - }; - - yankScope = mkOption { - type = str; - default = "Y"; - description = "Yank the scope to system clipboard."; - }; - - insertName = mkOption { - type = str; - default = "i"; - description = "Insert at the start of name."; - }; - - insertScope = mkOption { - type = str; - default = "I"; - description = "Insert at the start of scope."; - }; - - appendName = mkOption { - type = str; - default = "a"; - description = "Insert at the end of name."; - }; - - appendScope = mkOption { - type = str; - default = "A"; - description = "Insert at the end of scope."; - }; - - rename = mkOption { - type = str; - default = "r"; - description = "Rename the node."; - }; - - delete = mkOption { - type = str; - default = "d"; - description = "Delete the node."; - }; - - foldCreate = mkOption { - type = str; - default = "f"; - description = "Create a new fold of the node."; - }; - - foldDelete = mkOption { - type = str; - default = "F"; - description = "Delete the current fold of the node."; - }; - - comment = mkOption { - type = str; - default = "c"; - description = "Comment the node."; - }; - - select = mkOption { - type = str; - default = ""; - description = "Goto the node."; - }; - - moveDown = mkOption { - type = str; - default = "J"; - description = "Move the node down."; - }; - - moveUp = mkOption { - type = str; - default = "K"; - description = "Move the node up."; - }; - - togglePreview = mkOption { - type = str; - default = "s"; - description = "Toggle the preview."; - }; - - vsplit = mkOption { - type = str; - default = ""; - description = "Open the node in a vertical split."; - }; - - hsplit = mkOption { - type = str; - default = ""; - description = "Open the node in a horizontal split."; - }; - - telescope = mkOption { - type = str; - default = "t"; - description = "Start fuzzy finder at the current level."; - }; - - help = mkOption { - type = str; - default = "g?"; - description = "Open the mappings help window."; - }; + close = mkMappingOption "Close and return the cursor to its original location." ""; + nextSibling = mkMappingOption "Navigate to the next sibling node." "j"; + previousSibling = mkMappingOption "Navigate to the previous sibling node." "k"; + parent = mkMappingOption "Navigate to the parent node." "h"; + children = mkMappingOption "Navigate to the child node." "l"; + root = mkMappingOption "Navigate to the root node." "0"; + visualName = mkMappingOption "Select the name visually." "v"; + visualScope = mkMappingOption "Select the scope visually." "V"; + yankName = mkMappingOption "Yank the name to system clipboard." "y"; + yankScope = mkMappingOption "Yank the scope to system clipboard." "Y"; + insertName = mkMappingOption "Insert at the start of name." "i"; + insertScope = mkMappingOption "Insert at the start of scope." "I"; + appendName = mkMappingOption "Insert at the end of name." "a"; + appendScope = mkMappingOption "Insert at the end of scope." "A"; + rename = mkMappingOption "Rename the node." "r"; + delete = mkMappingOption "Delete the node." "d"; + foldCreate = mkMappingOption "Create a new fold of the node." "f"; + foldDelete = mkMappingOption "Delete the current fold of the node." "F"; + comment = mkMappingOption "Comment the node." "c"; + select = mkMappingOption "Goto the node." ""; + moveDown = mkMappingOption "Move the node down." "J"; + moveUp = mkMappingOption "Move the node up." "K"; + togglePreview = mkMappingOption "Toggle the preview." "s"; + vsplit = mkMappingOption "Open the node in a vertical split." ""; + hsplit = mkMappingOption "Open the node in a horizontal split." ""; + telescope = mkMappingOption "Start fuzzy finder at the current level." "t"; + help = mkMappingOption "Open the mappings help window." "g?"; }; setupOpts = mkPluginSetupOption "navbuddy" { diff --git a/modules/plugins/utility/motion/flash/flash.nix b/modules/plugins/utility/motion/flash/flash.nix index 825b86a0..55672a4d 100644 --- a/modules/plugins/utility/motion/flash/flash.nix +++ b/modules/plugins/utility/motion/flash/flash.nix @@ -1,38 +1,22 @@ -{lib, ...}: let - inherit (lib.options) mkEnableOption mkOption; - inherit (lib.types) nullOr str; +{ + config, + lib, + ... +}: let + inherit (lib.options) mkEnableOption; inherit (lib.nvim.types) mkPluginSetupOption; + inherit (config.vim.lib) mkMappingOption; in { options.vim.utility.motion.flash-nvim = { enable = mkEnableOption "enhanced code navigation with flash.nvim"; setupOpts = mkPluginSetupOption "flash-nvim" {}; mappings = { - jump = mkOption { - type = nullOr str; - default = "s"; - description = "Jump"; - }; - treesitter = mkOption { - type = nullOr str; - default = "S"; - description = "Treesitter"; - }; - remote = mkOption { - type = nullOr str; - default = "r"; - description = "Remote Flash"; - }; - treesitter_search = mkOption { - type = nullOr str; - default = "R"; - description = "Treesitter Search"; - }; - toggle = mkOption { - type = nullOr str; - default = ""; - description = "Toggle Flash Search"; - }; + jump = mkMappingOption "Jump" "s"; + treesitter = mkMappingOption "Treesitter" "S"; + remote = mkMappingOption "Remote Flash" "r"; + treesitter_search = mkMappingOption "Treesitter Search" "R"; + toggle = mkMappingOption "Toggle Flash Search" ""; }; }; } diff --git a/modules/plugins/utility/motion/leap/leap.nix b/modules/plugins/utility/motion/leap/leap.nix index 4e98f208..c443e781 100644 --- a/modules/plugins/utility/motion/leap/leap.nix +++ b/modules/plugins/utility/motion/leap/leap.nix @@ -1,36 +1,20 @@ -{lib, ...}: let - inherit (lib.options) mkEnableOption mkOption; - inherit (lib.types) nullOr str; +{ + config, + lib, + ... +}: let + inherit (lib.options) mkEnableOption; + inherit (config.vim.lib) mkMappingOption; in { options.vim.utility.motion.leap = { enable = mkEnableOption "leap.nvim plugin (easy motion)"; mappings = { - leapForwardTo = mkOption { - type = nullOr str; - description = "Leap forward to"; - default = "ss"; - }; - leapBackwardTo = mkOption { - type = nullOr str; - description = "Leap backward to"; - default = "sS"; - }; - leapForwardTill = mkOption { - type = nullOr str; - description = "Leap forward till"; - default = "sx"; - }; - leapBackwardTill = mkOption { - type = nullOr str; - description = "Leap backward till"; - default = "sX"; - }; - leapFromWindow = mkOption { - type = nullOr str; - description = "Leap from window"; - default = "gs"; - }; + leapForwardTo = mkMappingOption "Leap forward to" "ss"; + leapBackwardTo = mkMappingOption "Leap backward to" "sS"; + leapForwardTill = mkMappingOption "Leap forward till" "sx"; + leapBackwardTill = mkMappingOption "Leap backward till" "sX"; + leapFromWindow = mkMappingOption "Leap from window" "gs"; }; }; }