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