From c6ff6bbca686b2bc7d2597848b00c5182176ca0f Mon Sep 17 00:00:00 2001 From: Soliprem <73885403+Soliprem@users.noreply.github.com> Date: Sun, 10 Nov 2024 02:09:38 +0100 Subject: [PATCH] binds/which-key: changing to the new spec (#448) --- docs/release-notes/rl-0.7.md | 1 + modules/plugins/utility/binds/which-key/config.nix | 5 ++++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/release-notes/rl-0.7.md b/docs/release-notes/rl-0.7.md index f9532e5..e37fd81 100644 --- a/docs/release-notes/rl-0.7.md +++ b/docs/release-notes/rl-0.7.md @@ -309,6 +309,7 @@ To migrate to `nixfmt`, simply change `vim.languages.nix.format.type` to - Add [Tinymist](https://github.com/Myriad-Dreamin/tinymist] as a formatter for the Typst language module. - Add LSP and Treesitter support for Assembly under `vim.languages.assembly` +- Move [which-key](https://github.com/folke/which-key.nvim) to the new spec [Bloxx12](https://github.com/Bloxx12) diff --git a/modules/plugins/utility/binds/which-key/config.nix b/modules/plugins/utility/binds/which-key/config.nix index e4d03cb..01a29fb 100644 --- a/modules/plugins/utility/binds/which-key/config.nix +++ b/modules/plugins/utility/binds/which-key/config.nix @@ -5,9 +5,12 @@ }: let inherit (lib.modules) mkIf; inherit (lib.nvim.lua) toLuaObject; + inherit (lib.attrsets) mapAttrsToList; + inherit (lib.generators) mkLuaInline; inherit (lib.nvim.dag) entryAnywhere; cfg = config.vim.binds.whichKey; + register = mapAttrsToList (n: v: mkLuaInline "{ '${n}', desc = '${v}' }") cfg.register; in { config = mkIf cfg.enable { vim = { @@ -16,7 +19,7 @@ in { pluginRC.whichkey = entryAnywhere '' local wk = require("which-key") wk.setup (${toLuaObject cfg.setupOpts}) - wk.register(${toLuaObject cfg.register}) + wk.add(${toLuaObject register}) ''; }; };