mirror of
https://github.com/nix-community/nixvim.git
synced 2025-11-08 19:46:06 +01:00
plugins/which-key: cleanup, remove most settings declarations
Signed-off-by: saygo-png <saygo.mail@proton.me>
This commit is contained in:
parent
4d4e437cca
commit
6c2e8eece5
1 changed files with 5 additions and 231 deletions
|
|
@ -1,5 +1,4 @@
|
||||||
{ lib, ... }:
|
{ lib, ... }:
|
||||||
with lib;
|
|
||||||
let
|
let
|
||||||
inherit (lib) types;
|
inherit (lib) types;
|
||||||
inherit (lib.nixvim) defaultNullOpts;
|
inherit (lib.nixvim) defaultNullOpts;
|
||||||
|
|
@ -77,22 +76,6 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
maintainers = [ lib.maintainers.khaneliman ];
|
maintainers = [ lib.maintainers.khaneliman ];
|
||||||
|
|
||||||
settingsOptions = {
|
settingsOptions = {
|
||||||
preset = defaultNullOpts.mkEnumFirstDefault [
|
|
||||||
"classic"
|
|
||||||
"modern"
|
|
||||||
"helix"
|
|
||||||
false
|
|
||||||
] "Preset style for WhichKey. Set to false to disable.";
|
|
||||||
|
|
||||||
delay = defaultNullOpts.mkInt' {
|
|
||||||
pluginDefault = lib.nixvim.literalLua ''
|
|
||||||
function(ctx)
|
|
||||||
return ctx.plugin and 0 or 200
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
description = "Delay before showing the popup. Can be a number or a function that returns a number.";
|
|
||||||
};
|
|
||||||
|
|
||||||
filter = defaultNullOpts.mkLuaFn' {
|
filter = defaultNullOpts.mkLuaFn' {
|
||||||
pluginDefault = lib.nixvim.literalLua ''
|
pluginDefault = lib.nixvim.literalLua ''
|
||||||
function(mapping)
|
function(mapping)
|
||||||
|
|
@ -102,29 +85,6 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
description = "Filter used to exclude mappings";
|
description = "Filter used to exclude mappings";
|
||||||
};
|
};
|
||||||
|
|
||||||
spec = defaultNullOpts.mkListOf' {
|
|
||||||
type = with types; attrsOf anything;
|
|
||||||
pluginDefault = [ ];
|
|
||||||
description = ''
|
|
||||||
WhichKey automatically gets the descriptions of your keymaps from the desc attribute of the keymap.
|
|
||||||
So for most use-cases, you don't need to do anything else.
|
|
||||||
|
|
||||||
However, the mapping spec is still useful to configure group descriptions and mappings that don't really exist as a regular keymap.
|
|
||||||
|
|
||||||
Please refer to the plugin's [documentation](https://github.com/folke/which-key.nvim?tab=readme-ov-file#%EF%B8%8F-mappings).
|
|
||||||
'';
|
|
||||||
example = specExamples;
|
|
||||||
};
|
|
||||||
|
|
||||||
notify = defaultNullOpts.mkBool true "Show a warning when issues were detected with your mappings.";
|
|
||||||
|
|
||||||
triggers = defaultNullOpts.mkListOf (with types; attrsOf anything) [
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "<auto>";
|
|
||||||
mode = "nxsot";
|
|
||||||
}
|
|
||||||
] "Manually setup triggers";
|
|
||||||
|
|
||||||
defer = defaultNullOpts.mkLuaFn' {
|
defer = defaultNullOpts.mkLuaFn' {
|
||||||
pluginDefault = lib.nixvim.literalLua ''
|
pluginDefault = lib.nixvim.literalLua ''
|
||||||
function(ctx)
|
function(ctx)
|
||||||
|
|
@ -137,199 +97,13 @@ lib.nixvim.plugins.mkNeovimPlugin {
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
plugins = {
|
|
||||||
marks = defaultNullOpts.mkBool true ''
|
|
||||||
Shows a list of your marks on `'` and `` ` ``.
|
|
||||||
'';
|
|
||||||
|
|
||||||
registers = defaultNullOpts.mkBool true ''
|
|
||||||
Shows your registers on `"` in NORMAL or `<C-r>` in INSERT mode.
|
|
||||||
'';
|
|
||||||
|
|
||||||
spelling = {
|
|
||||||
enabled = defaultNullOpts.mkBool true ''
|
|
||||||
Enabling this will show WhichKey when pressing `z=` to select spelling suggestions.
|
|
||||||
'';
|
|
||||||
suggestions = defaultNullOpts.mkInt 20 ''
|
|
||||||
How many suggestions should be shown in the list?
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
|
|
||||||
presets = {
|
|
||||||
operators = defaultNullOpts.mkBool true "Adds help for operators like `d`, `y`, ...";
|
|
||||||
motions = defaultNullOpts.mkBool true "Adds help for motions.";
|
|
||||||
text_objects = defaultNullOpts.mkBool true "Help for text objects triggered after entering an operator.";
|
|
||||||
windows = defaultNullOpts.mkBool true "Default bindings on `<c-w>`.";
|
|
||||||
nav = defaultNullOpts.mkBool true "Misc bindings to work with windows.";
|
|
||||||
z = defaultNullOpts.mkBool true "Show WhichKey for folds, spelling and other bindings prefixed with `z`.";
|
|
||||||
g = defaultNullOpts.mkBool true "Show WhichKey for bindings prefixed with `g`.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
win = {
|
|
||||||
no_overlap = defaultNullOpts.mkBool true "Don't allow the popup to overlap with the cursor.";
|
|
||||||
|
|
||||||
border = defaultNullOpts.mkBorder "none" "which-key" ''
|
|
||||||
Allows configuring the border of which-key.
|
|
||||||
|
|
||||||
Supports all available border types from `vim.api.keyset.win_config.border`.
|
|
||||||
'';
|
|
||||||
|
|
||||||
padding = defaultNullOpts.mkNullable (types.listOfLen types.int 2) [
|
|
||||||
1
|
|
||||||
2
|
|
||||||
] "Extra window padding, in the form `[top/bottom, right/left]`.";
|
|
||||||
|
|
||||||
title = defaultNullOpts.mkBool true "Whether to show the title.";
|
|
||||||
|
|
||||||
title_pos = defaultNullOpts.mkStr "center" "Position of the title.";
|
|
||||||
|
|
||||||
zindex = defaultNullOpts.mkUnsignedInt 1000 "Layer depth on the popup window.";
|
|
||||||
|
|
||||||
wo = {
|
|
||||||
winblend =
|
|
||||||
defaultNullOpts.mkNullableWithRaw (types.ints.between 0 100) 0
|
|
||||||
"`0` for fully opaque and `100` for fully transparent.";
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
layout = {
|
|
||||||
width = {
|
|
||||||
min = defaultNullOpts.mkInt 20 "Minimum width.";
|
|
||||||
max = defaultNullOpts.mkInt null "Maximum width.";
|
|
||||||
};
|
|
||||||
|
|
||||||
spacing = defaultNullOpts.mkInt 3 "Spacing between columns.";
|
|
||||||
};
|
|
||||||
|
|
||||||
keys = {
|
|
||||||
scroll_up = defaultNullOpts.mkStr "<c-u>" "Binding to scroll up in the popup.";
|
|
||||||
scroll_down = defaultNullOpts.mkStr "<c-d>" "Binding to scroll down in the popup.";
|
|
||||||
};
|
|
||||||
|
|
||||||
sort =
|
|
||||||
defaultNullOpts.mkListOf
|
|
||||||
(types.enum [
|
|
||||||
"local"
|
|
||||||
"order"
|
|
||||||
"group"
|
|
||||||
"alphanum"
|
|
||||||
"mod"
|
|
||||||
"manual"
|
|
||||||
"case"
|
|
||||||
])
|
|
||||||
[
|
|
||||||
"local"
|
|
||||||
"order"
|
|
||||||
"group"
|
|
||||||
"alphanum"
|
|
||||||
"mod"
|
|
||||||
]
|
|
||||||
"Mappings are sorted using configured sorters and natural sort of the keys.";
|
|
||||||
|
|
||||||
expand = defaultNullOpts.mkInt 0 "Expand groups when <= n mappings.";
|
|
||||||
|
|
||||||
replace = {
|
replace = {
|
||||||
key =
|
key = defaultNullOpts.mkListOf (with types; either strLuaFn (listOf str)) (lib.nixvim.literalLua ''
|
||||||
defaultNullOpts.mkListOf (types.either types.strLuaFn (with types; listOf str))
|
function(key)
|
||||||
(lib.nixvim.literalLua ''
|
return require("which-key.view").format(key)
|
||||||
function(key)
|
end
|
||||||
return require("which-key.view").format(key)
|
'') "Lua functions or list of strings to replace key left side key name with.";
|
||||||
end
|
|
||||||
'')
|
|
||||||
"Lua functions or list of strings to replace key left side key name with.";
|
|
||||||
desc = defaultNullOpts.mkListOf (with types; listOf str) [
|
|
||||||
[
|
|
||||||
"<Plug>%(?(.*)%)?"
|
|
||||||
"%1"
|
|
||||||
]
|
|
||||||
[
|
|
||||||
"^%+"
|
|
||||||
""
|
|
||||||
]
|
|
||||||
[
|
|
||||||
"<[cC]md>"
|
|
||||||
""
|
|
||||||
]
|
|
||||||
[
|
|
||||||
"<[cC][rR]>"
|
|
||||||
""
|
|
||||||
]
|
|
||||||
[
|
|
||||||
"<[sS]ilent>"
|
|
||||||
""
|
|
||||||
]
|
|
||||||
[
|
|
||||||
"^lua%s+"
|
|
||||||
""
|
|
||||||
]
|
|
||||||
[
|
|
||||||
"^call%s+"
|
|
||||||
""
|
|
||||||
]
|
|
||||||
[
|
|
||||||
"^:%s*"
|
|
||||||
""
|
|
||||||
]
|
|
||||||
] "Lua patterns to replace right side description references with.";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
icons = {
|
|
||||||
breadcrumb = defaultNullOpts.mkStr "»" "Symbol used in the command line area that shows your active key combo.";
|
|
||||||
separator = defaultNullOpts.mkStr "➜" "Symbol used between a key and its label.";
|
|
||||||
group = defaultNullOpts.mkStr "+" "Symbol prepended to a group.";
|
|
||||||
ellipsis = defaultNullOpts.mkStr "…" "Symbol used for overflow.";
|
|
||||||
mappings = defaultNullOpts.mkBool true "Set to false to disable all mapping icons.";
|
|
||||||
rules = defaultNullOpts.mkNullable (with types; either (listOf attrs) bool) [
|
|
||||||
] "Icon rules. Set to false to disable all icons.";
|
|
||||||
colors = defaultNullOpts.mkBool true ''
|
|
||||||
Use the highlights from mini.icons.
|
|
||||||
|
|
||||||
When `false`, it will use `WhichKeyIcon` instead.
|
|
||||||
'';
|
|
||||||
|
|
||||||
keys = defaultNullOpts.mkNullable types.attrs {
|
|
||||||
Up = " ";
|
|
||||||
Down = " ";
|
|
||||||
Left = " ";
|
|
||||||
Right = " ";
|
|
||||||
C = " ";
|
|
||||||
M = " ";
|
|
||||||
D = " ";
|
|
||||||
S = " ";
|
|
||||||
CR = " ";
|
|
||||||
Esc = " ";
|
|
||||||
ScrollWheelDown = " ";
|
|
||||||
ScrollWheelUp = " ";
|
|
||||||
NL = " ";
|
|
||||||
BS = "";
|
|
||||||
Space = " ";
|
|
||||||
Tab = " ";
|
|
||||||
F1 = "";
|
|
||||||
F2 = "";
|
|
||||||
F3 = "";
|
|
||||||
F4 = "";
|
|
||||||
F5 = "";
|
|
||||||
F6 = "";
|
|
||||||
F7 = "";
|
|
||||||
F8 = "";
|
|
||||||
F9 = "";
|
|
||||||
F10 = "";
|
|
||||||
F11 = "";
|
|
||||||
F12 = "";
|
|
||||||
} "Icons used by key format.";
|
|
||||||
};
|
|
||||||
|
|
||||||
show_help = defaultNullOpts.mkBool true "Show a help message in the command line for using WhichKey.";
|
|
||||||
|
|
||||||
show_keys = defaultNullOpts.mkBool true "Show the currently pressed key and its label as a message in the command line.";
|
|
||||||
|
|
||||||
disable = {
|
|
||||||
bt = defaultNullOpts.mkListOf types.str [ ] "Buftypes to disable WhichKey.";
|
|
||||||
ft = defaultNullOpts.mkListOf types.str [ ] "Filetypes to disable WhichKey.";
|
|
||||||
};
|
|
||||||
|
|
||||||
debug = defaultNullOpts.mkBool false "Enable `wk.log` in the current directory.";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
settingsExample = {
|
settingsExample = {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue