From d9a984bf6f31f43f7b6f47de8283894aa07dd0a6 Mon Sep 17 00:00:00 2001 From: NotAShelf Date: Sun, 21 Apr 2024 02:10:06 +0300 Subject: [PATCH] modules/wrapper: move RC features to `wrapper/rc` --- modules/modules.nix | 1 + modules/neovim/default.nix | 6 - modules/neovim/mappings/config.nix | 59 ++++ modules/neovim/mappings/default.nix | 61 +--- modules/neovim/mappings/options.nix | 0 modules/wrapper/build/config.nix | 413 +--------------------------- modules/wrapper/default.nix | 6 - modules/wrapper/rc/config.nix | 214 ++++++++++++++ modules/wrapper/rc/default.nix | 6 + modules/wrapper/rc/options.nix | 252 +++++++++++++++++ 10 files changed, 539 insertions(+), 479 deletions(-) delete mode 100644 modules/neovim/default.nix create mode 100644 modules/neovim/mappings/config.nix create mode 100644 modules/neovim/mappings/options.nix delete mode 100644 modules/wrapper/default.nix create mode 100644 modules/wrapper/rc/config.nix create mode 100644 modules/wrapper/rc/default.nix create mode 100644 modules/wrapper/rc/options.nix diff --git a/modules/modules.nix b/modules/modules.nix index 77a35ea..22bc84a 100644 --- a/modules/modules.nix +++ b/modules/modules.nix @@ -49,6 +49,7 @@ # using the configuration passed in `neovim` and `plugins` modules. wrapper = map (p: ./wrapper + "/${p}") [ "build" + "rc" "warnings" ]; diff --git a/modules/neovim/default.nix b/modules/neovim/default.nix deleted file mode 100644 index 2342bef..0000000 --- a/modules/neovim/default.nix +++ /dev/null @@ -1,6 +0,0 @@ -{ - imports = [ - ./init - ./mappings - ]; -} diff --git a/modules/neovim/mappings/config.nix b/modules/neovim/mappings/config.nix new file mode 100644 index 0000000..8bc58af --- /dev/null +++ b/modules/neovim/mappings/config.nix @@ -0,0 +1,59 @@ +{ + config, + lib, + ... +}: let + inherit (lib.modules) mkIf; + + cfg = config.vim; +in { + config = { + vim.maps = { + normal = + mkIf cfg.disableArrows { + "" = { + action = ""; + + noremap = false; + }; + "" = { + action = ""; + + noremap = false; + }; + "" = { + action = ""; + noremap = false; + }; + "" = { + action = ""; + noremap = false; + }; + } + // mkIf cfg.mapLeaderSpace { + "" = { + action = ""; + }; + }; + + insert = mkIf cfg.disableArrows { + "" = { + action = ""; + noremap = false; + }; + "" = { + action = ""; + noremap = false; + }; + "" = { + action = ""; + noremap = false; + }; + "" = { + action = ""; + noremap = false; + }; + }; + }; + }; +} diff --git a/modules/neovim/mappings/default.nix b/modules/neovim/mappings/default.nix index 8bc58af..18ce626 100644 --- a/modules/neovim/mappings/default.nix +++ b/modules/neovim/mappings/default.nix @@ -1,59 +1,6 @@ { - config, - lib, - ... -}: let - inherit (lib.modules) mkIf; - - cfg = config.vim; -in { - config = { - vim.maps = { - normal = - mkIf cfg.disableArrows { - "" = { - action = ""; - - noremap = false; - }; - "" = { - action = ""; - - noremap = false; - }; - "" = { - action = ""; - noremap = false; - }; - "" = { - action = ""; - noremap = false; - }; - } - // mkIf cfg.mapLeaderSpace { - "" = { - action = ""; - }; - }; - - insert = mkIf cfg.disableArrows { - "" = { - action = ""; - noremap = false; - }; - "" = { - action = ""; - noremap = false; - }; - "" = { - action = ""; - noremap = false; - }; - "" = { - action = ""; - noremap = false; - }; - }; - }; - }; + imports = [ + ./config.nix + #./options.nix + ]; } diff --git a/modules/neovim/mappings/options.nix b/modules/neovim/mappings/options.nix new file mode 100644 index 0000000..e69de29 diff --git a/modules/wrapper/build/config.nix b/modules/wrapper/build/config.nix index 9cd7183..97788bd 100644 --- a/modules/wrapper/build/config.nix +++ b/modules/wrapper/build/config.nix @@ -3,418 +3,11 @@ lib, ... }: let - inherit (builtins) map mapAttrs toJSON filter; - inherit (lib.options) mkOption mkEnableOption literalMD literalExpression; - inherit (lib.attrsets) filterAttrs getAttrs attrValues attrNames; - inherit (lib.strings) optionalString isString concatStringsSep; - inherit (lib.misc) mapAttrsFlatten; - inherit (lib.trivial) showWarnings; - inherit (lib.types) bool str oneOf attrsOf nullOr attrs submodule lines listOf either path; - inherit (lib.generators) mkLuaInline; - inherit (lib.nvim.types) dagOf; - inherit (lib.nvim.dag) entryAnywhere entryAfter topoSort mkLuarcSection mkVimrcSection; - inherit (lib.nvim.lua) toLuaObject wrapLuaConfig listToLuaTable; - inherit (lib.nvim.vim) valToVim; - inherit (lib.nvim.config) mkBool; + inherit (lib.attrsets) attrValues; cfg = config.vim; - - # Most of the keybindings code is highly inspired by pta2002/nixvim. - # Thank you! - mapConfigOptions = { - silent = - mkBool false - "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