mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-01 11:01:15 +00:00
binds/which-key: start migrating to setupOpts
This commit is contained in:
parent
8e4b632280
commit
a3f4b7b147
2 changed files with 49 additions and 23 deletions
|
@ -4,33 +4,21 @@
|
|||
...
|
||||
}: 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 = {
|
||||
startPlugins = ["which-key"];
|
||||
|
||||
vim.pluginRC.whichkey = entryAnywhere ''
|
||||
local wk = require("which-key")
|
||||
wk.setup ({
|
||||
key_labels = {
|
||||
["<space>"] = "SPACE",
|
||||
["<leader>"] = "SPACE",
|
||||
["<cr>"] = "RETURN",
|
||||
["<tab>"] = "TAB",
|
||||
},
|
||||
pluginRC.whichkey = entryAnywhere ''
|
||||
local wk = require("which-key")
|
||||
|
||||
${optionalString config.vim.ui.borders.plugins.which-key.enable ''
|
||||
window = {
|
||||
border = ${toLuaObject config.vim.ui.borders.plugins.which-key.style},
|
||||
},
|
||||
''}
|
||||
})
|
||||
|
||||
wk.register(${toLuaObject cfg.register})
|
||||
'';
|
||||
wk.setup (${toLuaObject cfg.setupOpts})
|
||||
wk.register(${toLuaObject cfg.register})
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
{lib, ...}: let
|
||||
inherit (lib.options) mkEnableOption mkOption;
|
||||
inherit (lib.types) attrsOf nullOr str;
|
||||
{
|
||||
config,
|
||||
lib,
|
||||
...
|
||||
}: let
|
||||
inherit (lib.options) mkOption mkEnableOption;
|
||||
inherit (lib.types) attrsOf nullOr str attrs enum bool;
|
||||
inherit (lib.nvim.types) mkPluginSetupOption;
|
||||
in {
|
||||
options.vim.binds.whichKey = {
|
||||
enable = mkEnableOption "which-key keybind helper menu";
|
||||
|
@ -10,5 +15,38 @@ in {
|
|||
type = attrsOf (nullOr str);
|
||||
default = {};
|
||||
};
|
||||
|
||||
setupOpts = mkPluginSetupOption "which-key" {
|
||||
preset = mkOption {
|
||||
type = enum ["classic" "modern" "helix"];
|
||||
default = "modern";
|
||||
description = "The default preset for the which-key window";
|
||||
};
|
||||
|
||||
notify = mkOption {
|
||||
type = bool;
|
||||
default = false; # FIXME: this should be true before the merge
|
||||
description = "Show a warning when issues were detected with mappings";
|
||||
};
|
||||
|
||||
replace = mkOption {
|
||||
type = attrs;
|
||||
default = {
|
||||
"<space>" = "SPACE";
|
||||
"<leader>" = "SPACE";
|
||||
"<cr>" = "RETURN";
|
||||
"<tab>" = "TAB";
|
||||
};
|
||||
description = "Functions/Lua Patterns for formatting the labels";
|
||||
};
|
||||
|
||||
win = {
|
||||
border = mkOption {
|
||||
type = str;
|
||||
default = config.vim.ui.borders.plugins.which-key.style;
|
||||
description = "Which-key window border style";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue