From 0649f710beb3af16657a9708d6d226b64e80c292 Mon Sep 17 00:00:00 2001 From: n3oney Date: Mon, 10 Apr 2023 13:42:31 +0200 Subject: [PATCH] refactor!: use a new keymaps configuration format --- modules/basic/config.nix | 56 +++- modules/core/default.nix | 297 +++++++++++++------ modules/lsp/lspsaga/config.nix | 30 +- modules/lsp/lspsaga/lspsaga.nix | 30 +- modules/lsp/nvim-code-action-menu/config.nix | 4 +- modules/lsp/trouble/config.nix | 14 +- modules/notes/mind-nvim/config.nix | 8 +- modules/notes/todo-comments/config.nix | 8 +- modules/tabline/nvim-bufferline/config.nix | 36 +-- modules/utility/motion/hop/config.nix | 4 +- modules/utility/telescope/config.nix | 38 +-- 11 files changed, 343 insertions(+), 182 deletions(-) diff --git a/modules/basic/config.nix b/modules/basic/config.nix index 1b4512a3..a1db94b9 100644 --- a/modules/basic/config.nix +++ b/modules/basic/config.nix @@ -10,21 +10,51 @@ in { config = { vim.startPlugins = ["plenary-nvim"]; - vim.nmap = mkIf cfg.disableArrows { - "" = ""; - "" = ""; - "" = ""; - "" = ""; - }; + vim.maps.normal = + mkIf cfg.disableArrows { + "" = { + action = ""; - vim.imap = mkIf cfg.disableArrows { - "" = ""; - "" = ""; - "" = ""; - "" = ""; - }; + noremap = false; + }; + "" = { + action = ""; - vim.nnoremap = mkIf cfg.mapLeaderSpace {"" = "";}; + noremap = false; + }; + "" = { + action = ""; + noremap = false; + }; + "" = { + action = ""; + noremap = false; + }; + } + // mkIf cfg.mapLeaderSpace { + "" = { + action = ""; + }; + }; + + vim.maps.insert = mkIf cfg.disableArrows { + "" = { + action = ""; + noremap = false; + }; + "" = { + action = ""; + noremap = false; + }; + "" = { + action = ""; + noremap = false; + }; + "" = { + action = ""; + noremap = false; + }; + }; vim.configRC.basic = nvim.dag.entryAfter ["globalsScript"] '' " Debug mode settings diff --git a/modules/core/default.nix b/modules/core/default.nix index 78232b32..6e92cff7 100644 --- a/modules/core/default.nix +++ b/modules/core/default.nix @@ -19,6 +19,107 @@ with builtins; let type = with types; attrsOf (nullOr str); } // it); + + mkBool = value: description: + mkOption { + type = types.bool; + default = value; + description = description; + }; + + # 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