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