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.strings) optionalString;
|
|
|
|
inherit (lib.nvim.lua) toLuaObject;
|
|
|
|
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;
|
|
|
|
in {
|
2024-07-08 23:57:58 +02:00
|
|
|
config = mkIf cfg.enable {
|
2023-02-28 08:13:56 +01:00
|
|
|
vim.startPlugins = ["which-key"];
|
|
|
|
|
2024-07-20 10:30:48 +02:00
|
|
|
vim.pluginRC.whichkey = entryAnywhere ''
|
2023-04-02 21:54:19 +02:00
|
|
|
local wk = require("which-key")
|
|
|
|
wk.setup ({
|
|
|
|
key_labels = {
|
|
|
|
["<space>"] = "SPACE",
|
|
|
|
["<leader>"] = "SPACE",
|
|
|
|
["<cr>"] = "RETURN",
|
|
|
|
["<tab>"] = "TAB",
|
2023-07-26 09:27:57 +02:00
|
|
|
},
|
|
|
|
|
2024-07-08 23:57:58 +02:00
|
|
|
${optionalString config.vim.ui.borders.plugins.which-key.enable ''
|
2023-07-26 09:27:57 +02:00
|
|
|
window = {
|
|
|
|
border = "${config.vim.ui.borders.plugins.which-key.style}",
|
|
|
|
},
|
|
|
|
''}
|
2023-04-02 21:54:19 +02:00
|
|
|
})
|
2023-02-28 08:13:56 +01:00
|
|
|
|
2024-02-21 04:15:18 +01:00
|
|
|
wk.register(${toLuaObject cfg.register})
|
2023-02-28 08:13:56 +01:00
|
|
|
'';
|
|
|
|
};
|
|
|
|
}
|