2023-02-28 07:13:56 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
2023-11-07 00:50:27 +00:00
|
|
|
}: let
|
2024-02-21 03:15:18 +00:00
|
|
|
inherit (lib.modules) mkIf;
|
|
|
|
inherit (lib.nvim.lua) toLuaObject;
|
2024-11-10 01:09:38 +00:00
|
|
|
inherit (lib.attrsets) mapAttrsToList;
|
|
|
|
inherit (lib.generators) mkLuaInline;
|
2024-02-21 03:15:18 +00:00
|
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
2023-11-07 00:50:27 +00:00
|
|
|
|
2023-02-28 07:13:56 +00:00
|
|
|
cfg = config.vim.binds.whichKey;
|
2024-11-10 01:09:38 +00:00
|
|
|
register = mapAttrsToList (n: v: mkLuaInline "{ '${n}', desc = '${v}' }") cfg.register;
|
2023-02-28 07:13:56 +00:00
|
|
|
in {
|
2024-07-08 21:57:58 +00:00
|
|
|
config = mkIf cfg.enable {
|
2024-11-08 10:22:50 +00:00
|
|
|
vim = {
|
|
|
|
startPlugins = ["which-key"];
|
2023-02-28 07:13:56 +00:00
|
|
|
|
2024-11-08 10:22:50 +00:00
|
|
|
pluginRC.whichkey = entryAnywhere ''
|
|
|
|
local wk = require("which-key")
|
|
|
|
wk.setup (${toLuaObject cfg.setupOpts})
|
2024-11-10 01:09:38 +00:00
|
|
|
wk.add(${toLuaObject register})
|
2024-11-08 10:22:50 +00:00
|
|
|
'';
|
|
|
|
};
|
2023-02-28 07:13:56 +00:00
|
|
|
};
|
|
|
|
}
|