diff --git a/flake.lock b/flake.lock index 6e4a8f9..0c70b45 100644 --- a/flake.lock +++ b/flake.lock @@ -624,6 +624,83 @@ "type": "github" } }, + "flake-compat_6": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, + "flake-parts": { + "inputs": { + "nixpkgs-lib": [ + "neovim-nightly", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1690933134, + "narHash": "sha256-ab989mN63fQZBFrkk4Q8bYxQCktuHmBIBqUG1jl6/FQ=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "59cf3f1447cfc75087e7273b04b31e689a8599fb", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, + "flake-parts_2": { + "inputs": { + "nixpkgs-lib": "nixpkgs-lib" + }, + "locked": { + "lastModified": 1688466019, + "narHash": "sha256-VeM2akYrBYMsb4W/MmBo1zmaMfgbL4cH3Pu8PGyIwJ0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8e8d955c22df93dbe24f19ea04f47a74adbdc5ec", + "type": "github" + }, + "original": { + "id": "flake-parts", + "type": "indirect" + } + }, + "flake-parts_3": { + "inputs": { + "nixpkgs-lib": [ + "neovim-nightly", + "hercules-ci-effects", + "hercules-ci-agent", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1688466019, + "narHash": "sha256-VeM2akYrBYMsb4W/MmBo1zmaMfgbL4cH3Pu8PGyIwJ0=", + "owner": "hercules-ci", + "repo": "flake-parts", + "rev": "8e8d955c22df93dbe24f19ea04f47a74adbdc5ec", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "flake-parts", + "type": "github" + } + }, "flake-utils": { "locked": { "lastModified": 1676283394, @@ -655,12 +732,15 @@ } }, "flake-utils_3": { + "inputs": { + "systems": "systems" + }, "locked": { - "lastModified": 1667395993, - "narHash": "sha256-nuEHfE/LcWyuSWnS8t12N1wc105Qtau+/OdUAjtQ0rA=", + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", "owner": "numtide", "repo": "flake-utils", - "rev": "5aed5285a952e0b949eb3ba02c12fa4fcfef535f", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", "type": "github" }, "original": { @@ -699,6 +779,24 @@ "type": "github" } }, + "flake-utils_6": { + "inputs": { + "systems": "systems_2" + }, + "locked": { + "lastModified": 1685518550, + "narHash": "sha256-o2d0KcvaXzTrPRIo0kOLV0/QXHhDQ5DTi+OxcjO8xqY=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "a1720a10a6cfe8234c0e93907ffe81be440f4cef", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, "format-all": { "flake": false, "locked": { @@ -732,6 +830,86 @@ "type": "github" } }, + "gitignore": { + "inputs": { + "nixpkgs": [ + "nixvim", + "pre-commit-hooks", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1660459072, + "narHash": "sha256-8DFJjXG8zqoONA1vXtgeKXy68KdJL5UaXR8NtVMUbx8=", + "owner": "hercules-ci", + "repo": "gitignore.nix", + "rev": "a20de23b925fd8264fd7fad6454652e142fd7f73", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "gitignore.nix", + "type": "github" + } + }, + "haskell-flake": { + "locked": { + "lastModified": 1684780604, + "narHash": "sha256-2uMZsewmRn7rRtAnnQNw1lj0uZBMh4m6Cs/7dV5YF08=", + "owner": "srid", + "repo": "haskell-flake", + "rev": "74210fa80a49f1b6f67223debdbf1494596ff9f2", + "type": "github" + }, + "original": { + "owner": "srid", + "ref": "0.3.0", + "repo": "haskell-flake", + "type": "github" + } + }, + "hercules-ci-agent": { + "inputs": { + "flake-parts": "flake-parts_3", + "haskell-flake": "haskell-flake", + "nixpkgs": "nixpkgs_3" + }, + "locked": { + "lastModified": 1688568579, + "narHash": "sha256-ON0M56wtY/TIIGPkXDlJboAmuYwc73Hi8X9iJGtxOhM=", + "owner": "hercules-ci", + "repo": "hercules-ci-agent", + "rev": "367dd8cd649b57009a6502e878005a1e54ad78c5", + "type": "github" + }, + "original": { + "id": "hercules-ci-agent", + "type": "indirect" + } + }, + "hercules-ci-effects": { + "inputs": { + "flake-parts": "flake-parts_2", + "hercules-ci-agent": "hercules-ci-agent", + "nixpkgs": [ + "neovim-nightly", + "nixpkgs" + ] + }, + "locked": { + "lastModified": 1689397210, + "narHash": "sha256-fVxZnqxMbsDkB4GzGAs/B41K0wt/e+B/fLxmTFF/S20=", + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "rev": "0a63bfa3f00a3775ea3a6722b247880f1ffe91ce", + "type": "github" + }, + "original": { + "owner": "hercules-ci", + "repo": "hercules-ci-effects", + "type": "github" + } + }, "home": { "inputs": { "nixpkgs": [ @@ -907,11 +1085,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1677269843, - "narHash": "sha256-2liWrba7/Mx2Vky/SGjJnDm/GXxui4sxMIz0OAQW0jM=", + "lastModified": 1691000564, + "narHash": "sha256-cFWh06gKGTg7yS4o9Ps/KLBZftwk/8eKJpHH951N2yA=", "owner": "neovim", "repo": "neovim", - "rev": "a601d031127689a7d60cc92f4ec89907794ed020", + "rev": "4a06de40e7c5bfe3be8f243b23b1676034fc6b08", "type": "github" }, "original": { @@ -924,17 +1102,19 @@ "neovim-nightly": { "inputs": { "flake-compat": "flake-compat_2", + "flake-parts": "flake-parts", + "hercules-ci-effects": "hercules-ci-effects", "neovim-flake": "neovim-flake", "nixpkgs": [ "nixos" ] }, "locked": { - "lastModified": 1677312846, - "narHash": "sha256-CBEkl8diEBReMl5xamfx9pYgzToMY4tMGs5I9ghf+x4=", + "lastModified": 1691021119, + "narHash": "sha256-SlYNdhMnWNSob13hlZKNbVhVVYlp/mpqRpB8Ye6E/Og=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "31c7e7155194d0abf0ac6109c241b383cd2b2475", + "rev": "3d29676e1f473a587a77a8fd321a54af6bb6cea9", "type": "github" }, "original": { @@ -1137,6 +1317,24 @@ "type": "indirect" } }, + "nixpkgs-lib": { + "locked": { + "dir": "lib", + "lastModified": 1688049487, + "narHash": "sha256-100g4iaKC9MalDjUW9iN6Jl/OocTDtXdeAj7pEGIRh4=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "4bc72cae107788bf3f24f30db2e2f685c9298dc9", + "type": "github" + }, + "original": { + "dir": "lib", + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs-regression": { "locked": { "lastModified": 1643052045, @@ -1153,6 +1351,22 @@ "type": "github" } }, + "nixpkgs-stable": { + "locked": { + "lastModified": 1685801374, + "narHash": "sha256-otaSUoFEMM+LjBI1XL/xGB5ao6IwnZOXc47qhIgJe8U=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "c37ca420157f4abc31e26f436c1145f8951ff373", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-23.05", + "repo": "nixpkgs", + "type": "github" + } + }, "nixpkgs_2": { "locked": { "lastModified": 1653988320, @@ -1169,24 +1383,41 @@ "type": "github" } }, + "nixpkgs_3": { + "locked": { + "lastModified": 1688322751, + "narHash": "sha256-eW62dC5f33oKZL7VWlomttbUnOTHrAbte9yNUNW8rbk=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "0fbe93c5a7cac99f90b60bdf5f149383daaa615f", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nixvim": { "inputs": { "beautysh": "beautysh", "flake-utils": "flake-utils_5", "nixpkgs": [ "nixos" - ] + ], + "pre-commit-hooks": "pre-commit-hooks" }, "locked": { - "lastModified": 1677348479, - "narHash": "sha256-9k2qZo+1KPRRfHzIUs9gfrTxx7ZR+KGPLkpWpDRlp5U=", - "owner": "pta2002", + "lastModified": 1690107839, + "narHash": "sha256-ll3j+g3qz239sfLHYhHynKRWhMkxFXsJ9MOAXzSqQMc=", + "owner": "nix-community", "repo": "nixvim", - "rev": "705356d4787ecddfc88629ca7ec5e03a8edb4944", + "rev": "4c25722d73694245e767839b462026ab2296542b", "type": "github" }, "original": { - "owner": "pta2002", + "owner": "nix-community", "repo": "nixvim", "type": "github" } @@ -1350,6 +1581,31 @@ "type": "github" } }, + "pre-commit-hooks": { + "inputs": { + "flake-compat": "flake-compat_4", + "flake-utils": "flake-utils_6", + "gitignore": "gitignore", + "nixpkgs": [ + "nixvim", + "nixpkgs" + ], + "nixpkgs-stable": "nixpkgs-stable" + }, + "locked": { + "lastModified": 1690743255, + "narHash": "sha256-dsJzQsyJGWCym1+LMyj2rbYmvjYmzeOrk7ypPrSFOPo=", + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "rev": "fcbf4705d98398d084e6cb1c826a0b90a91d22d7", + "type": "github" + }, + "original": { + "owner": "cachix", + "repo": "pre-commit-hooks.nix", + "type": "github" + } + }, "revealjs": { "flake": false, "locked": { @@ -1410,7 +1666,7 @@ "simple-mailserver": { "inputs": { "blobs": "blobs", - "flake-compat": "flake-compat_4", + "flake-compat": "flake-compat_5", "nixpkgs": [ "unstable" ], @@ -1454,7 +1710,7 @@ "stylix": { "inputs": { "base16": "base16", - "flake-compat": "flake-compat_5", + "flake-compat": "flake-compat_6", "home-manager": [ "home" ], @@ -1477,6 +1733,36 @@ "type": "github" } }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, + "systems_2": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + }, "ts-fold": { "flake": false, "locked": { @@ -1495,11 +1781,11 @@ }, "unstable": { "locked": { - "lastModified": 1677063315, - "narHash": "sha256-qiB4ajTeAOVnVSAwCNEEkoybrAlA+cpeiBxLobHndE8=", + "lastModified": 1691006197, + "narHash": "sha256-DbtxVWPt+ZP5W0Usg7jAyTomIM//c3Jtfa59Ht7AV8s=", "owner": "NixOS", "repo": "nixpkgs", - "rev": "988cc958c57ce4350ec248d2d53087777f9e1949", + "rev": "66aedfd010204949cb225cf749be08cb13ce1813", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 96e846d..be1b999 100644 --- a/flake.nix +++ b/flake.nix @@ -64,7 +64,8 @@ inputs.nixpkgs.follows = "nixos"; }; nixvim = { - url = "github:pta2002/nixvim"; + url = "github:nix-community/nixvim"; + # url = "/home/luc/repos/nixvim"; inputs.nixpkgs.follows = "nixos"; }; arkenfox.url = "github:dwarfmaster/arkenfox-nixos"; @@ -109,6 +110,10 @@ tree-sitter-make-grammar = super.callPackage (nixos + "/pkgs/development/tools/parsing/tree-sitter/grammar.nix") {}; + inherit (unstable.legacyPackages.${super.system}) + csharp-ls + vscode-langservers-extracted + nixd; } // packages self super; variants = self: super: pkgs-variants super.system; diff --git a/modules/nixvim/.gitkeep b/modules/nixvim/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/modules/nixvim/which-keys/default.nix b/modules/nixvim/which-keys/default.nix deleted file mode 100644 index 45dab72..0000000 --- a/modules/nixvim/which-keys/default.nix +++ /dev/null @@ -1,462 +0,0 @@ -{ - config, - pkgs, - lib, - ... -}: let - inherit - (lib) - mkIf - mkMerge - mkOption - mkEnableOption - types - ; - - cfg = config.plugins.which-key; - - mkSelect = default: name: - mkOption { - inherit default; - description = lib.mdDoc "Wether to enable ${name}"; - type = types.bool; - }; - - printB = b: - if b - then "true" - else "false"; - - renderList = lib.concatMapStringsSep ", " (v: "\"${v}\""); - - bindingType = types.submodule ({config, ...}: { - options = { - binding = mkOption { - description = lib.mdDoc "The binding"; - type = types.nullOr types.str; - example = "Telescope find_files"; - default = null; - }; - cmd = mkOption { - description = lib.mdDoc "The command to execute. Will set binding."; - type = types.nullOr types.str; - example = "Telescope find_files"; - default = null; - }; - lua = mkOption { - description = lib.mdDoc "Lua code to execute. Will set binding."; - type = types.nullOr types.str; - example = "print(\"bar\")"; - default = null; - }; - description = mkOption { - description = lib.mdDoc "The description of the binding."; - type = types.str; - example = "Find files in project"; - }; - silent = mkOption { - description = lib.mdDoc "Use `silent` when creating binding."; - type = types.nullOr types.bool; - default = null; - }; - noremap = mkOption { - description = lib.mdDoc "Use `noremap` when creating binding."; - type = types.nullOr types.bool; - default = null; - }; - buffer = mkOption { - description = lib.mdDoc "Create binding only for specific buffer."; - type = types.nullOr types.ints.positive; - default = null; - }; - }; - - config = mkMerge [ - (mkIf (!(builtins.isNull config.cmd)) {binding = "${config.cmd}";}) - (mkIf (!(builtins.isNull config.lua)) {binding = "function() ${config.lua} end";}) - ]; - }); - - bindingTreeType = types.submodule ({config, ...}: { - options = { - name = mkOption { - description = "Name of the category"; - type = types.nullOr types.str; - default = null; - }; - bindings = mkOption { - description = "Bindings at this level"; - type = types.attrsOf bindingType; - default = {}; - }; - subs = mkOption { - description = "Sub-trees"; - type = types.attrsOf bindingTreeType; - default = {}; - }; - }; - }); - - mergeAll = lib.foldr (as1: as2: as1 // as2) {}; - prepareMapping = opts: prefix: key: bd: let - nullOr = v1: v2: - if builtins.isNull v1 - then v2 - else v1; - inherit (bd) description binding; - silent = nullOr bd.silent opts.silent; - noremap = nullOr bd.noremap opts.noremap; - buffer = nullOr bd.buffer opts.buffer; - in - lib.nameValuePair (prefix + key) ( - {inherit binding description silent noremap;} - // ( - if builtins.isNull buffer - then {} - else {inherit buffer;} - ) - // {lua = !(builtins.isNull bd.lua);} - ); - accumulateMapping = opts: prefix: name: tree: let - category = { - "${prefix}" = - if builtins.isNull tree.name - then name - else tree.name; - }; - bindings = lib.mapAttrs' (prepareMapping opts prefix) tree.bindings; - subs = lib.mapAttrsToList (k: accumulateMapping opts (prefix + k) k) tree.subs; - in - mergeAll ([category bindings] ++ subs); - mappings = let - opts = { - silent = true; - noremap = true; - buffer = null; - }; - in - lib.mapAttrs (_: maps: mergeAll (lib.mapAttrsToList (key: accumulateMapping opts key key) maps)) cfg.bindings; - - escapeCmd = m: - if m.lua - then m.binding - else "\"" + builtins.replaceStrings ["\""] ["\\\""] m.binding + "\""; - renderMapping = m: - if builtins.isString m - then "{ name = \"${m}\" }" - else - ( - if builtins.isNull m.binding - then "\"${m.description}\"" - else - "{ ${escapeCmd m}, \"${m.description}\", " - + "silent=${printB m.silent}, noremap=${printB m.noremap}" - + ( - if m ? "buffer" - then ", buffer${toString m.buffer} }" - else "}" - ) - ); - renderMappings = mode: mappings: '' - require('which-key').register({ - ${lib.concatStringsSep ",\n " - (lib.mapAttrsToList (k: m: "[\"${k}\"] = ${renderMapping m}") mappings)} - }, { mode = "${mode}" }) - ''; - renderedMappings = lib.concatStringsSep "\n" (lib.mapAttrsToList renderMappings mappings); -in { - options.plugins.which-key = { - enable = mkEnableOption "which-key.nvim plugin"; - - plugins = { - marks = mkSelect true "completion for marks"; - registers = mkSelect true "completion for registers"; - spelling = { - enable = mkSelect false "completion for spelling"; - suggestions = mkOption { - default = 20; - type = types.int; - description = lib.mdDoc "Number of spelling suggestions to show"; - }; - }; - presets = { - enable = mkSelect true "completion for default keybindings"; - operators = mkSelect cfg.plugins.presets.enable "completion for operators"; - motions = mkSelect cfg.plugins.presets.enable "completion for motions"; - text_objects = mkSelect cfg.plugins.presets.enable "completion for text objects"; - windows = mkSelect cfg.plugins.presets.enable "completion for windows"; - nav = mkSelect cfg.plugins.presets.enable "completion for navigation"; - z = mkSelect cfg.plugins.presets.enable "completion for bindings beggining with z"; - g = mkSelect cfg.plugins.presets.enable "completion for bindings beggining with g"; - }; - }; - - operators = mkOption { - description = lib.mdDoc "Operators to trigger motion and text object completion for"; - type = types.attrsOf types.str; - default = {}; - example = {gc = "Comments";}; - }; - - labels = mkOption { - description = lib.mdDoc "Change label used to display some keys"; - type = types.attrsOf types.str; - default = {}; - example = { - "" = "SPC"; - "" = "RET"; - }; - }; - - icons = { - breadcrumb = mkOption { - description = lib.mdDoc "Symbol used to show active key combo"; - type = types.str; - default = "»"; - }; - separator = mkOption { - description = lib.mdDoc "Symbol used between a key and its label"; - type = types.str; - default = "➜"; - }; - group = mkOption { - description = lib.mdDoc "Symbol prepended to a group"; - type = types.str; - default = "+"; - }; - }; - - popup = { - scroll = { - up = mkOption { - description = lib.mdDoc "Binding to scroll up inside the popup"; - type = types.str; - default = ""; - }; - down = mkOption { - description = lib.mdDoc "Binding to scroll down inside the popup"; - type = types.str; - default = ""; - }; - }; - - window = { - border = mkOption { - description = lib.mdDoc "The border of the popup window"; - type = types.enum ["none" "single" "double" "shadow"]; - default = "none"; - }; - position = mkOption { - description = lib.mdDoc "Position of the popup window"; - type = types.enum ["bottom" "top"]; - default = "bottom"; - }; - margin = let - mkMargin = def: desc: - mkOption { - default = def; - description = lib.mdDoc "${desc} window margin"; - type = types.int; - }; - in { - top = mkMargin 1 "Top"; - bottom = mkMargin 1 "Bottom"; - left = mkMargin 0 "Left"; - right = mkMargin 0 "Right"; - }; - padding = let - mkPadding = def: desc: - mkOption { - default = def; - description = lib.mdDoc "${desc} window padding"; - type = types.int; - }; - in { - top = mkPadding 2 "Top"; - bottom = mkPadding 2 "Bottom"; - left = mkPadding 2 "Left"; - right = mkPadding 2 "Right"; - }; - blend = mkOption { - description = lib.mdDoc "Blend from total opacity (0) to transparency (100)"; - type = types.ints.between 0 100; - default = 0; - }; - }; - - layout = let - mkMinMax = m: cat: def: - mkOption { - description = lib.mdDoc "${m} ${cat} of the columns"; - type = types.ints.positive; - default = def; - }; - in { - height = { - min = mkMinMax "Min" "height" 4; - max = mkMinMax "Max" "height" 25; - }; - width = { - min = mkMinMax "Min" "width" 20; - max = mkMinMax "Max" "width" 50; - }; - spacing = mkOption { - description = lib.mdDoc "Spacing between columns"; - default = 3; - type = types.ints.positive; - }; - align = mkOption { - description = lib.mdDoc "Align columns"; - default = "left"; - type = types.enum ["left" "center" "right"]; - }; - }; - }; - - missing = mkOption { - description = lib.mdDoc "Show mappings without a label"; - default = true; - type = types.bool; - }; - hidden = mkOption { - description = lib.mdDoc "Hide mapping boilerplate"; - type = types.listOf types.str; - default = ["" "" "" "" "call" "lua" "^:" "^ "]; - }; - help = mkOption { - description = lib.mdDoc "Show help messages when popup is visible"; - type = types.bool; - default = true; - }; - triggers = { - setup = mkOption { - description = lib.mdDoc "Prefixes hooked by which-key"; - type = types.either (types.enum ["auto"]) (types.listOf types.str); - default = "auto"; - example = [""]; - }; - blacklist = mkOption { - description = lib.mdDoc "Modes + prefixes that shouldn't be hooked by which-key"; - type = types.attrsOf (types.listOf types.str); - default = { - i = ["j" "k"]; - v = ["j" "k"]; - }; - }; - }; - disable = { - buftypes = mkOption { - description = lib.mdDoc "Buffer types to disable which-key in"; - type = types.listOf types.str; - default = []; - }; - filetypes = mkOption { - description = lib.mdDoc "File types to disable which-key in"; - type = types.listOf types.str; - default = ["TelescopePromp"]; - }; - }; - - bindings = let - mkBindings = name: - mkOption { - description = lib.mdDoc "Bindings for ${name} mode."; - type = types.attrsOf bindingTreeType; - default = {}; - }; - in { - n = mkBindings "normal"; - i = mkBindings "insert"; - v = mkBindings "visual"; - }; - }; - - config = mkIf cfg.enable { - # Assertions are not supported in submodules - # assertions = [ - # { assertion = cfg.popup.layout.height.min <= cfg.popup.layout.height.max - # ; message = "which-key.nvim max column height must be greater than min column height"; } - # { assertion = cfg.popup.layout.width.min <= cfg.popup.layout.width.max - # ; message = "which-key.nvim max column width must be greater than min column width"; } - # ]; - - extraPlugins = [pkgs.vimPlugins.which-key-nvim]; - extraConfigLua = let - triggers = - if builtins.isString cfg.triggers.setup - then "\"${cfg.triggers.setup}\"" - else "{ " + lib.concatMapStringsSep ", " (v: "\"${v}\"") cfg.triggers.setup + " }"; - in '' - -- Set up which-keys {{{ - require('which-key').setup({ - plugins = { - marks = ${printB cfg.plugins.marks}, - registers = ${printB cfg.plugins.registers}, - spelling = { - enabled = ${printB cfg.plugins.spelling.enable}, - suggestions = ${toString cfg.plugins.spelling.suggestions}, - }, - presets = { - operators = ${printB cfg.plugins.presets.operators}, - motions = ${printB cfg.plugins.presets.motions}, - text_objects = ${printB cfg.plugins.presets.text_objects}, - windows = ${printB cfg.plugins.presets.windows}, - nav = ${printB cfg.plugins.presets.nav}, - z = ${printB cfg.plugins.presets.z}, - g = ${printB cfg.plugins.presets.g}, - }, - }, - operators = { ${lib.concatStringsSep ", " (lib.mapAttrsToList (n: v: "${n} = \"${v}\"") cfg.operators)} }, - key_labels = { - ${lib.concatStringsSep ",\n" (lib.mapAttrsToList (n: v: "[\"${n}\"] = \"${v}\"") cfg.labels)} - }, - icons = { - breadcrumb = "${cfg.icons.breadcrumb}", - separator = "${cfg.icons.separator}", - group = "${cfg.icons.group}", - }, - popup_mappings = { - scroll_down = '${cfg.popup.scroll.down}', - scroll_up = '${cfg.popup.scroll.up}', - }, - window = { - border = "${cfg.popup.window.border}", - position = "${cfg.popup.window.position}", - margin = { ${let - m = cfg.popup.window.margin; - in "${toString m.top}, ${toString m.right}, ${toString m.bottom}, ${toString m.left}"} }, - padding = { ${let - m = cfg.popup.window.padding; - in "${toString m.top}, ${toString m.right}, ${toString m.bottom}, ${toString m.left}"} }, - winblend = ${toString cfg.popup.window.blend} - }, - layout = { - height = { min = ${toString cfg.popup.layout.height.min}, max = ${toString cfg.popup.layout.height.max} }, - width = { min = ${toString cfg.popup.layout.width.min}, max = ${toString cfg.popup.layout.width.max} }, - spacing = ${toString cfg.popup.layout.spacing}, - align = "${cfg.popup.layout.align}", - }, - ignore_missing = ${printB (!cfg.missing)}, - hidden = { ${renderList cfg.hidden}}, - show_help = ${printB cfg.help}, - triggers = ${triggers}, - triggers_blacklist = { - ${lib.concatStringsSep ",\n " - (lib.mapAttrsToList - (n: v: "${n} = { ${renderList v} }") - cfg.triggers.blacklist)} - }, - disable = { - buftypes = { ${renderList cfg.disable.buftypes} }, - filetypes = { ${renderList cfg.disable.filetypes} }, - }, - }) - - --- Keybindings {{{ - ${renderedMappings} - --- }}} - - --- }}} - ''; - }; -} diff --git a/profiles/hm/languages/haskell/default.nix b/profiles/hm/languages/haskell/default.nix index afc53d9..4df8202 100644 --- a/profiles/hm/languages/haskell/default.nix +++ b/profiles/hm/languages/haskell/default.nix @@ -9,10 +9,6 @@ cabal-install cabal2nix ; - inherit - (pkgs.haskellPackages) - structured-haskell-mode - ; ghc = pkgs.haskellPackages.ghcWithHoogle (hpkgs: [hpkgs.diagrams]); @@ -28,4 +24,8 @@ ]; }; }; + + programs.nixvim = { + plugins.lsp.servers.hls.enable = true; + }; } diff --git a/profiles/hm/languages/lua/default.nix b/profiles/hm/languages/lua/default.nix index d58a93b..1b9c4af 100644 --- a/profiles/hm/languages/lua/default.nix +++ b/profiles/hm/languages/lua/default.nix @@ -8,11 +8,11 @@ in { home.packages = [ lua.lua - pkgs.sumneko-lua-language-server + lua.lua-lsp ]; programs.nixvim = { - plugins.lsp.enabledServers = ["sumneko_lua"]; + plugins.lsp.enabledServers = ["lua_ls"]; }; programs.doom-emacs.config = { @@ -24,13 +24,5 @@ in { } ]; }; - # TODO derivation for sumneko-lsp hardcode ~/.cache for logs and meta - modules.dwarfmaster.lua = { - config.text = '' - (after! lsp-lua - (setq lsp-clients-lua-language-server-main-location "${pkgs.sumneko-lua-language-server}/share/lua-language-server/main.lua") - (setq lsp-clients-lua-language-server-bin "${pkgs.sumneko-lua-language-server}/bin/lua-language-server")) - ''; - }; }; } diff --git a/profiles/hm/programs/neovim/config.nix b/profiles/hm/programs/neovim/config.nix index afbbb64..e8ab844 100644 --- a/profiles/hm/programs/neovim/config.nix +++ b/profiles/hm/programs/neovim/config.nix @@ -74,32 +74,31 @@ in { # Which-key plugins.which-key = { enable = true; - popup.window = { + window = { border = "none"; margin.left = 2; margin.right = 2; margin.bottom = 0; - blend = 10; + margin.top = 1; + winblend = 10; }; - labels = { + keyLabels = { " " = ""; }; - bindings.n = { - "".subs = { - "f".name = "file"; - "c".name = "code"; - "j".name = "jump"; - "b".name = "buffer"; - "o".name = "open/close"; - "v".name = "git"; - "s".name = "search"; - "d".name = "debug"; - "w".name = "window"; - "h".name = "help"; - "t".name = "toggle"; - " ".name = "local"; - }; - }; + }; + maps.normal = { + "f".desc = "file"; + "c".desc = "code"; + "j".desc = "jump"; + "b".desc = "buffer"; + "o".desc = "open/close"; + "v".desc = "git"; + "s".desc = "search"; + "d".desc = "debug"; + "w".desc = "window"; + "h".desc = "help"; + "t".desc = "toggle"; + " ".desc = "local"; }; }; } diff --git a/profiles/hm/programs/neovim/default.nix b/profiles/hm/programs/neovim/default.nix index 9320a73..53e1daf 100644 --- a/profiles/hm/programs/neovim/default.nix +++ b/profiles/hm/programs/neovim/default.nix @@ -11,12 +11,30 @@ home.packages = [ pkgs.unstable.neovide - # pkgs.neovim pkgs.fzy ]; - programs.nixvim.enable = true; - # programs.neovim.package = pkgs.neovim-nightly; + programs.nixvim = { + enable = true; + wrapRc = false; + # files."ftplugin/nix.vim".extraConfigVim = '' + # noremap gg :echom "test" + # ''; + # files."ftplugin/ocaml.lua".extraConfigVim = '' + # noremap gg :echom "test ocaml" + # ''; + # files."ftplugin/tmp.lua".extraConfigLua = '' + # function MyTest() + # end + # ''; + # files."ftdetect/tmp.lua".autoCmd = [ + # { + # event = [ "BufRead" "BufNewFile" ]; + # pattern = [ "*.temp" ]; + # command = "set ft=tmp"; + # } + # ]; + }; services.korrvigs = { constants.nvim = "${config.programs.neovim.package}/bin/nvim"; diff --git a/profiles/nixvim/cmp/default.nix b/profiles/nixvim/cmp/default.nix index d9470be..73c21f1 100644 --- a/profiles/nixvim/cmp/default.nix +++ b/profiles/nixvim/cmp/default.nix @@ -12,11 +12,12 @@ plugins.nvim-cmp = { enable = true; mappingPresets = ["insert" "cmdline"]; - snippet.expand = '' - function(args) - require('luasnip').lsp_expand(args.body) - end - ''; + snippet.expand = "luasnip"; + # TODO + # function(args) + # require('luasnip').lsp_expand(args.body) + # end + # ''; sources = [ {name = "nvim_lsp";} {name = "buffer";} diff --git a/profiles/nixvim/comments/default.nix b/profiles/nixvim/comments/default.nix index 8f33694..d2a32fd 100644 --- a/profiles/nixvim/comments/default.nix +++ b/profiles/nixvim/comments/default.nix @@ -8,29 +8,21 @@ enable = true; sticky = true; # Avoid moving the cursor }; - plugins.which-key = { - bindings = { - n."g".subs = { - "c" = { - name = "Comments"; - bindings = { - "c" = {description = "Toggle comment";}; - "o" = {description = "Insert comment next line";}; - "O" = {description = "Insert comment previous line";}; - "A" = {description = "Insert comment end of line";}; - }; - }; - "b".name = "Block comments"; - "b".bindings."c" = {description = "Toggle block comment";}; - }; - v."g".bindings = { - "c" = {description = "Toggle comment";}; - "b" = {description = "Toggle block comment";}; - }; - }; - operators = { - "gc" = "Comment"; - "gb" = "Block comment"; - }; + maps.normal = { + "gc".desc = "Comments"; + "gcc".desc = "Toggle comment"; + "gco".desc = "Insert comment next line"; + "gcO".desc = "Insert comment previous line"; + "gcA".desc = "Insert comment end of line"; + "gb".desc = "Block comments"; + "gbc".desc = "Toggle block comment"; + }; + maps.visual = { + "gc".desc = "Toggle comment"; + "gb".desc = "Toggle block comment"; + }; + plugins.which-key.operators = { + "gc" = "Comments"; + "gb" = "Block comments"; }; } diff --git a/profiles/nixvim/direnv/default.nix b/profiles/nixvim/direnv/default.nix index a565cce..8f2ef84 100644 --- a/profiles/nixvim/direnv/default.nix +++ b/profiles/nixvim/direnv/default.nix @@ -10,14 +10,14 @@ direnv_edit_mode = "edit"; # one of edit, split, vsplit direnv_silent_load = 1; }; - plugins.which-key.bindings.n."".subs = { - "t".bindings."D" = { - cmd = "DirenvExport"; - description = "Reload direnv"; + maps.normal = { + "tD" = { + action = "DirenvExport"; + desc = "Reload direnv"; }; - "o".bindings."D" = { - cmd = "EditEnvrc"; - description = "Open loaded envrc"; + "oD" = { + action = "EditEnvrc"; + desc = "Open loaded envrc"; }; }; } diff --git a/profiles/nixvim/escape/default.nix b/profiles/nixvim/escape/default.nix index 7a157ce..d432185 100644 --- a/profiles/nixvim/escape/default.nix +++ b/profiles/nixvim/escape/default.nix @@ -14,17 +14,9 @@ }; easyescape_timeout = 100; }; - plugins.which-key = { - bindings.i = { - "j".bindings."k" = { - binding = ""; - description = "Exits insert mode"; - }; - "k".bindings."j" = { - binding = ""; - description = "Exits insert mode"; - }; - }; - triggers.blacklist.i = ["j" "k"]; + maps.insert = { + "jk".desc = "Exits insert mode"; + "kj".desc = "Exits insert mode"; }; + plugins.which-key.triggersBlackList.i = ["j" "k"]; } diff --git a/profiles/nixvim/gitgutter/default.nix b/profiles/nixvim/gitgutter/default.nix index 41e511d..4d7578b 100644 --- a/profiles/nixvim/gitgutter/default.nix +++ b/profiles/nixvim/gitgutter/default.nix @@ -10,64 +10,59 @@ defaultMaps = false; previewWinFloating = true; }; - plugins.which-key.bindings = let + maps.normal = let picker = name: desc: { - lua = "require'telescope.builtin'.${name}{}"; - description = desc; + action = "function() require'telescope.builtin'.${name}{} end"; + lua = true; + inherit desc; }; in { - n = { - "]".bindings."c" = { - binding = "(GitGutterNextHunk)"; - description = "Next git hunk"; - }; - "[".bindings."c" = { - binding = "(GitGutterPrevHunk)"; - description = "Prev git hunk"; - }; - "".subs."t".bindings = { - "G" = { - cmd = "GitGutterToggle"; - description = "Toggle gitgutter"; - }; - "g" = { - cmd = "GitGutterBufferToggle"; - description = "Toggle gitgutter on buffer"; - }; - }; - "".subs."v".bindings = { - "s" = { - cmd = "GitGutterStageHunk"; - description = "Stage hunk"; - }; - "u" = { - cmd = "GitGutterUndoHunk"; - description = "Undo staging"; - }; - "p" = { - cmd = "GitGutterPreviewHunk"; - description = "Preview hunk"; - }; - "D" = { - cmd = "GitGutterDiffOrig"; - description = "View diff"; - }; - "F" = { - cmd = "GitGutterFold"; - description = "Fold unchanged"; - }; - "c" = picker "git_commits" "List commits"; - "C" = picker "git_bcommits" "Diff to commits"; - "B" = picker "git_branches" "List branches"; - "S" = picker "git_status" "List changes"; - "Z" = picker "git_stash" "List stash items"; - }; + "]c" = { + action = "(GitGutterNextHunk)"; + desc = "Next git hunk"; }; - v."".subs."v".bindings = { - "s" = { - cmd = "GitGutterStageHunk"; - description = "Stage hunk"; - }; + "[c" = { + action = "(GitGutterPrevHunk)"; + desc = "Prev git hunk"; + }; + "tG" = { + action = "GitGutterToggle"; + desc = "Toggle gitgutter"; + }; + "tg" = { + action = "GitGutterBufferToggle"; + desc = "Toggle gitgutter on buffer"; + }; + "vs" = { + action = "GitGutterStageHunk"; + desc = "Stage hunk"; + }; + "vu" = { + action = "GitGutterUndoHunk"; + desc = "Undo staging"; + }; + "vp" = { + action = "GitGutterPreviewHunk"; + desc = "Preview hunk"; + }; + "vD" = { + action = "GitGutterDiffOrig"; + desc = "View diff"; + }; + "vF" = { + action = "GitGutterFold"; + desc = "Fold unchanged"; + }; + "vc" = picker "git_commits" "List commits"; + "vC" = picker "git_bcommits" "Diff to commits"; + "vB" = picker "git_branches" "List branches"; + "vS" = picker "git_status" "List changes"; + "vZ" = picker "git_stash" "List stash items"; + }; + maps.visual = { + "vs" = { + action = "GitGutterStageHunk"; + desc = "Stage hunk"; }; }; } diff --git a/profiles/nixvim/lsp/default.nix b/profiles/nixvim/lsp/default.nix index 8c4895e..48e8704 100644 --- a/profiles/nixvim/lsp/default.nix +++ b/profiles/nixvim/lsp/default.nix @@ -13,60 +13,52 @@ borderStyle = "rounded"; }; - plugins.which-key.bindings.n = let + maps.normal = let picker = name: desc: { - lua = "require'telescope.builtin'.${name}{}"; - description = desc; + action = "function() require'telescope.builtin'.${name}{} end"; + lua = true; + inherit desc; }; saga = action: desc: { - cmd = "Lspsaga ${action}"; - description = desc; + action = "Lspsaga ${action}"; + inherit desc; }; in { - "g".bindings = { - "d" = picker "lsp_definitions" "Jump to definition"; - "D" = picker "lsp_implementations" "Jump to implementation"; - "t" = picker "lsp_type_definition" "Jump to type definition"; + "gd" = picker "lsp_definitions" "Jump to definition"; + "gD" = picker "lsp_implementations" "Jump to implementation"; + "gt" = picker "lsp_type_definition" "Jump to type definition"; + "]e" = saga "diagnostic_jump_next" "Next diagnostic"; + "[e" = saga "diagnostic_jump_prev" "Prev diagnostic"; + "cl".desc = "lsp"; + "cli" = { + action = "LspInfo"; + desc = "Info"; }; - "]".bindings."e" = saga "diagnostic_jump_next" "Next diagnostic"; - "[".bindings."e" = saga "diagnostic_jump_prev" "Prev diagnostic"; - "".subs."c".subs."l".name = "lsp"; - "".subs."c".subs."l".bindings = { - "i" = { - cmd = "LspInfo"; - description = "Info"; - }; - "S" = { - cmd = "LspStop"; - description = "Stop"; - }; - "s" = { - cmd = "LspStart"; - description = "Start"; - }; - "R" = { - cmd = "LspRestart"; - description = "Restart"; - }; + "clS" = { + action = "LspStop"; + desc = "Stop"; }; - "".subs."c".bindings = { - "r" = picker "lsp_references" "References to current symbol"; - "s" = picker "lsp_document_symbols" "List symbols in document"; - "S" = picker "lsp_workspace_symbols" "List symbols in workspace"; - "k" = saga "hover_doc" "Doc"; - "p" = saga "preview_definition" "Preview definition"; - "g" = saga "show_cursor_diagnostics" "Diagnostics at cursor"; - "G" = picker "diagnostics" "Diagnostics"; - "a" = saga "code_action" "Code actions"; - "R" = saga "rename" "Rename"; + "cls" = { + action = "LspStart"; + desc = "Start"; }; - "".subs."c".subs."d".name = "diagnostics"; - "".subs."c".subs."d".bindings = { - "d" = saga "show_line_diagnostics" "At line"; - "c" = saga "show_cursor_diagnostics" "At cursor"; - "f" = picker "diagnostics" "All file"; + "clR" = { + action = "LspRestart"; + desc = "Restart"; }; - "".subs."t".bindings."d" = saga "toggle_virtual_text" "Inline diagnostics"; + "cr" = picker "lsp_references" "References to current symbol"; + "cs" = picker "lsp_document_symbols" "List symbols in document"; + "cS" = picker "lsp_workspace_symbols" "List symbols in workspace"; + "ck" = saga "hover_doc" "Doc"; + "cp" = saga "preview_definition" "Preview definition"; + "cg" = saga "show_cursor_diagnostics" "Diagnostics at cursor"; + "cG" = picker "diagnostics" "Diagnostics"; + "ca" = saga "code_action" "Code actions"; + "cR" = saga "rename" "Rename"; + "cd".desc = "diagnostics"; + "cdd" = saga "show_line_diagnostics" "At line"; + "cdc" = saga "show_cursor_diagnostics" "At cursor"; + "cdf" = picker "diagnostics" "All file"; + "td" = saga "toggle_virtual_text" "Inline diagnostics"; }; - # TODO setup float terminal } diff --git a/profiles/nixvim/notify/default.nix b/profiles/nixvim/notify/default.nix index c4bfa5c..6298807 100644 --- a/profiles/nixvim/notify/default.nix +++ b/profiles/nixvim/notify/default.nix @@ -17,10 +17,10 @@ # }; }; plugins.telescope.enabledExtensions = ["notify"]; - plugins.which-key.bindings.n."".subs."s".bindings = { - "N" = { - cmd = "Telescope notify"; - description = "Notifications"; + maps.normal = { + "sN" = { + action = "Telescope notify"; + desc = "Notifications"; }; }; } diff --git a/profiles/nixvim/projects/default.nix b/profiles/nixvim/projects/default.nix index d403f43..445cbb4 100644 --- a/profiles/nixvim/projects/default.nix +++ b/profiles/nixvim/projects/default.nix @@ -9,8 +9,9 @@ silentChdir = false; }; plugins.telescope.extensions.project-nvim.enable = true; - plugins.which-key.bindings.n."".subs."f".bindings."p" = { - lua = "require('telescope').extensions.projects.projects{}"; - description = "Select project"; + maps.normal."fp" = { + action = "function() require('telescope').extensions.projects.projects{} end"; + lua = true; + desc = "Select project"; }; } diff --git a/profiles/nixvim/telescope/default.nix b/profiles/nixvim/telescope/default.nix index 795eb6f..3b3cbbf 100644 --- a/profiles/nixvim/telescope/default.nix +++ b/profiles/nixvim/telescope/default.nix @@ -11,54 +11,37 @@ fzy-native.enable = true; }; }; - plugins.which-key.bindings.n = let + maps.normal = let picker = name: desc: { - lua = "require'telescope.builtin'.${name}{}"; - description = desc; + action = "function() require'telescope.builtin'.${name}{} end"; + lua = true; + desc = desc; }; in { - "" = { - bindings = { - "/" = picker "live_grep" "Search text"; - "*" = picker "grep_string" "Search text under cursor"; - "," = picker "buffers" "Search buffers"; - ":" = picker "command_history" "Search command history"; - }; - subs = { - "f".bindings = { - "f" = picker "find_files" "Search files"; - "r" = picker "oldfiles" "Find recent"; - }; - "b".bindings = { - "j" = picker "loclist" "Locations"; - "t" = picker "current_buffer_tags" "Search tags"; - "s" = picker "current_buffer_fuzzy_find" "Fuzzy find"; - }; - "v".bindings = { - "f" = picker "git_files" "Added files"; - }; - "s".bindings = { - "s" = picker "resume" "Resume previous search"; - "h" = picker "search_history" "Search search history"; - "t" = picker "tags" "Search tags"; - "c" = picker "command_history" "Search command history"; - "m" = picker "marks" "Search marks"; - "r" = picker "registers" "Search registers"; - }; - "h".bindings = { - "h" = picker "help_tags" "Search help tags"; - "c" = picker "commands" "List commands"; - "m" = picker "man_pages" "Search man pages"; - "o" = picker "options" "List options"; - "a" = picker "autocommands" "List autocommands"; - "k" = picker "keymaps" "List keymaps"; - "F" = picker "filetypes" "List available filetypes"; - "H" = picker "highlights" "List available highlights"; - }; - "j".bindings = { - "l" = picker "jumplist" "Jumplist"; - }; - }; - }; + "/" = picker "live_grep" "Search text"; + "*" = picker "grep_string" "Search text under cursor"; + "," = picker "buffers" "Search buffers"; + ":" = picker "command_history" "Search command history"; + "ff" = picker "find_files" "Search files"; + "fr" = picker "oldfiles" "Find recent"; + "bj" = picker "loclist" "Locations"; + "bt" = picker "current_buffer_tags" "Search tags"; + "bs" = picker "current_buffer_fuzzy_find" "Fuzzy find"; + "vf" = picker "git_files" "Added files"; + "ss" = picker "resume" "Resume previous search"; + "sh" = picker "search_history" "Search search history"; + "st" = picker "tags" "Search tags"; + "sc" = picker "command_history" "Search command history"; + "sm" = picker "marks" "Search marks"; + "sr" = picker "registers" "Search registers"; + "hh" = picker "help_tags" "Search help tags"; + "hc" = picker "commands" "List commands"; + "hm" = picker "man_pages" "Search man pages"; + "ho" = picker "options" "List options"; + "ha" = picker "autocommands" "List autocommands"; + "hk" = picker "keymaps" "List keymaps"; + "hF" = picker "filetypes" "List available filetypes"; + "hH" = picker "highlights" "List available highlights"; + "jl" = picker "jumplist" "Jumplist"; }; } diff --git a/profiles/nixvim/treesitter/default.nix b/profiles/nixvim/treesitter/default.nix index dc534c7..1179065 100644 --- a/profiles/nixvim/treesitter/default.nix +++ b/profiles/nixvim/treesitter/default.nix @@ -15,16 +15,17 @@ (grammar: grammar.pname != "tree-sitter-norg-grammar") pkgs.tree-sitter.allGrammars; }; - plugins.which-key.bindings = { - n."g".subs."n".bindings."n" = {description = "Select treesitter node";}; - n."".subs."c".bindings."T" = { - lua = "require'telescope.builtin'.treesitter{}"; - description = "Treesitter symbols"; - }; - v."g".subs."r".bindings = { - "n" = {description = "Increment treesitter node";}; - "c" = {description = "Increment treesitter scope";}; - "m" = {description = "Decrement treesitter node";}; + maps.normal = { + "gnn".desc = "Select treesitter node"; + "cT" = { + action = "function() require'telescope.builtin'.treesitter{} end"; + lua = true; + desc = "Treesitter symbols"; }; }; + maps.visual = { + "grn".desc = "Increment treesitter node"; + "grc".desc = "Increment treesitter scope"; + "grm".desc = "Decrement treesitter node"; + }; } diff --git a/profiles/nixvim/windows/default.nix b/profiles/nixvim/windows/default.nix index 898d288..da6b7f3 100644 --- a/profiles/nixvim/windows/default.nix +++ b/profiles/nixvim/windows/default.nix @@ -4,58 +4,27 @@ pkgs, ... }: { - plugins.which-key.bindings.n."".subs."w".bindings = { - "w" = { - cmd = "wincmd p"; - description = "Jump to recent"; - }; - "v" = { - cmd = "vsplit"; - description = "Split vertically"; - }; - "-" = { - cmd = "split"; - description = "Split horizontally"; - }; - "D" = { - binding = "ge"; - description = "Detach current window"; - }; - "c" = { - cmd = "close"; - description = "Close current window"; - }; - "j" = { - cmd = "wincmd j"; - description = "Jump down"; - }; - "k" = { - cmd = "wincmd k"; - description = "Jump up"; - }; - "h" = { - cmd = "wincmd h"; - description = "Jump left"; - }; - "l" = { - cmd = "wincmd l"; - description = "Jump right"; - }; - "J" = { - cmd = "resize -5"; - description = "Decrease height"; - }; - "K" = { - cmd = "resize +5"; - description = "Increase height"; - }; - "H" = { - cmd = "vertical resize -5"; - description = "Decrease width"; - }; - "L" = { - cmd = "vertical resize +5"; - description = "Increase width"; - }; + maps.normal = let + cmd = cmd: desc: { + action = "${cmd}"; + inherit desc; + }; + in { + "ww" = cmd "wincmd p" "Jump to recent"; + "wv" = cmd "vsplit" "Split vertically"; + "w-" = cmd "split" "Split horizontally"; + "wD" = { + action = "ge"; + desc = "Detach current window"; + }; + "wc" = cmd "close" "Close current window"; + "wj" = cmd "wincmd j" "Jump down"; + "wk" = cmd "wincmd k" "Jump up"; + "wh" = cmd "wincmd h" "Jump left"; + "wl" = cmd "wincmd l" "Jump right"; + "wJ" = cmd "resize -5" "Decrease height"; + "wK" = cmd "resize +5" "Increase height"; + "wH" = cmd "vertical resize -5" "Decrease width"; + "wL" = cmd "vertical resize +5" "Increase width"; }; }