From 1d2b8e2d409d79bf69e5105b1a9ac171ef644791 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Tue, 27 Jan 2026 12:54:02 +0300 Subject: [PATCH] modules: move mappings to `neovim/init` Signed-off-by: NotAShelf Change-Id: I9b04107496df27dcda1a24ce000da3f46a6a6964 --- modules/modules.nix | 1 - modules/neovim/init/default.nix | 1 + modules/neovim/init/mappings.nix | 156 ++++++++++++++++++++++++++++ modules/neovim/mappings/config.nix | 27 ----- modules/neovim/mappings/default.nix | 6 -- modules/neovim/mappings/options.nix | 104 ------------------- 6 files changed, 157 insertions(+), 138 deletions(-) create mode 100644 modules/neovim/init/mappings.nix delete mode 100644 modules/neovim/mappings/default.nix diff --git a/modules/modules.nix b/modules/modules.nix index 654cd5ce..63605805 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -10,7 +10,6 @@ # such as spellchecking, mappings, and the init script (init.vim). neovim = map (p: ./neovim + "/${p}") [ "init" - "mappings" ]; # Individual plugin modules, separated by the type of plugin. diff --git a/modules/neovim/init/default.nix b/modules/neovim/init/default.nix index 641cc0e1..e831fab6 100644 --- a/modules/neovim/init/default.nix +++ b/modules/neovim/init/default.nix @@ -8,6 +8,7 @@ ./filetype.nix ./highlight.nix ./lsp.nix + ./mappings.nix ./spellcheck.nix ./util.nix ]; diff --git a/modules/neovim/init/mappings.nix b/modules/neovim/init/mappings.nix new file mode 100644 index 00000000..0f665101 --- /dev/null +++ b/modules/neovim/init/mappings.nix @@ -0,0 +1,156 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkMerge; + inherit (lib.options) mkOption literalMD; + inherit (lib.types) either str listOf attrsOf nullOr submodule; + inherit (lib.attrsets) mapAttrsToList; + inherit (lib.lists) flatten; + inherit (lib.trivial) pipe; + inherit (lib.options) mkEnableOption; + inherit (lib.nvim.config) mkBool; + + mapConfigOptions = { + desc = mkOption { + type = nullOr str; + default = null; + description = '' + Description for the keybind, to be shown in which-key, if you have enabled + in the module system. + ''; + }; + + action = mkOption { + type = str; + description = "The command to execute."; + }; + + lua = mkBool false '' + If true, `action` is considered to be lua code. + Thus, it will not be wrapped in `""`. + ''; + + silent = mkBool true "Whether this mapping should be silent. Equivalent to adding to a map."; + nowait = mkBool false "Whether to wait for extra input on ambiguous mappings. Equivalent to adding to a map."; + script = mkBool false "Equivalent to adding