nvf/modules/plugins/utility/binds/which-key/config.nix

37 lines
817 B
Nix
Raw Permalink Normal View History

{
config,
lib,
...
}: let
inherit (lib.modules) mkIf;
inherit (lib.strings) optionalString;
inherit (lib.nvim.lua) toLuaObject;
inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.binds.whichKey;
in {
config = mkIf (cfg.enable) {
vim.startPlugins = ["which-key"];
vim.luaConfigRC.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",
},
${optionalString (config.vim.ui.borders.plugins.which-key.enable) ''
window = {
border = "${config.vim.ui.borders.plugins.which-key.style}",
},
''}
2023-04-02 19:54:19 +00:00
})
wk.register(${toLuaObject cfg.register})
'';
};
}