mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
plugins/which-key: updated spec examples and tests
Improve documentation for supported configurations
This commit is contained in:
parent
fb4e6c2361
commit
ebd2182b44
2 changed files with 100 additions and 46 deletions
|
@ -11,6 +11,68 @@ let
|
||||||
types = lib.nixvim.nixvimTypes;
|
types = lib.nixvim.nixvimTypes;
|
||||||
|
|
||||||
opt = options.plugins.which-key;
|
opt = options.plugins.which-key;
|
||||||
|
|
||||||
|
specExamples = [
|
||||||
|
# Basic group
|
||||||
|
{
|
||||||
|
__unkeyed-1 = "<leader>b";
|
||||||
|
group = " Buffers";
|
||||||
|
}
|
||||||
|
# Non-default mode
|
||||||
|
{
|
||||||
|
__unkeyed = "<leader>c";
|
||||||
|
mode = "v";
|
||||||
|
group = " Codesnap";
|
||||||
|
}
|
||||||
|
# Group within group
|
||||||
|
{
|
||||||
|
__unkeyed-1 = "<leader>bs";
|
||||||
|
group = " Sort";
|
||||||
|
}
|
||||||
|
# Nested mappings for inheritance
|
||||||
|
{
|
||||||
|
mode = [
|
||||||
|
"n"
|
||||||
|
"v"
|
||||||
|
];
|
||||||
|
__unkeyed-1 = [
|
||||||
|
{
|
||||||
|
__unkeyed-1 = "<leader>f";
|
||||||
|
group = "Normal Visual Group";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
__unkeyed-1 = "<leader>f<tab>";
|
||||||
|
group = "Normal Visual Group in Group";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
# Proxy mapping
|
||||||
|
{
|
||||||
|
__unkeyed-1 = "<leader>w";
|
||||||
|
proxy = "<C-w>";
|
||||||
|
group = "windows";
|
||||||
|
}
|
||||||
|
# Create mapping
|
||||||
|
{
|
||||||
|
__unkeyed-1 = "<leader>cS";
|
||||||
|
__unkeyed-2 = "<cmd>CodeSnapSave<CR>";
|
||||||
|
mode = "v";
|
||||||
|
desc = "Save";
|
||||||
|
}
|
||||||
|
# Function mapping
|
||||||
|
{
|
||||||
|
__unkeyed-1 = "<leader>db";
|
||||||
|
__unkeyed-2.__raw = ''
|
||||||
|
function()
|
||||||
|
require("dap").toggle_breakpoint()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
mode = "n";
|
||||||
|
desc = "Breakpoint toggle";
|
||||||
|
silent = true;
|
||||||
|
}
|
||||||
|
];
|
||||||
|
|
||||||
in
|
in
|
||||||
lib.nixvim.neovim-plugin.mkNeovimPlugin config {
|
lib.nixvim.neovim-plugin.mkNeovimPlugin config {
|
||||||
name = "which-key";
|
name = "which-key";
|
||||||
|
@ -246,22 +308,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin config {
|
||||||
|
|
||||||
Please refer to the plugin's [documentation](https://github.com/folke/which-key.nvim?tab=readme-ov-file#%EF%B8%8F-mappings).
|
Please refer to the plugin's [documentation](https://github.com/folke/which-key.nvim?tab=readme-ov-file#%EF%B8%8F-mappings).
|
||||||
'';
|
'';
|
||||||
example = [
|
example = specExamples;
|
||||||
{
|
|
||||||
__unkeyed-1 = "<leader>w";
|
|
||||||
proxy = "<C-w>";
|
|
||||||
group = "windows";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "<leader>b";
|
|
||||||
group = " Buffers";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed = "<leader>r";
|
|
||||||
mode = "x";
|
|
||||||
group = " Refactor";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
};
|
};
|
||||||
|
|
||||||
notify = defaultNullOpts.mkBool true "Show a warning when issues were detected with your mappings.";
|
notify = defaultNullOpts.mkBool true "Show a warning when issues were detected with your mappings.";
|
||||||
|
@ -483,36 +530,7 @@ lib.nixvim.neovim-plugin.mkNeovimPlugin config {
|
||||||
|
|
||||||
delay = 200;
|
delay = 200;
|
||||||
|
|
||||||
spec = [
|
spec = specExamples;
|
||||||
{
|
|
||||||
__unkeyed-1 = "<leader>b";
|
|
||||||
group = " Buffers";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "<leader>bs";
|
|
||||||
group = " Sort";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "<leader>g";
|
|
||||||
group = " Git";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "<leader>f";
|
|
||||||
group = " Find";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "<leader>r";
|
|
||||||
group = " Refactor";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "<leader>t";
|
|
||||||
group = " Terminal";
|
|
||||||
}
|
|
||||||
{
|
|
||||||
__unkeyed-1 = "<leader>u";
|
|
||||||
group = " UI/UX";
|
|
||||||
}
|
|
||||||
];
|
|
||||||
|
|
||||||
replace = {
|
replace = {
|
||||||
desc = [
|
desc = [
|
||||||
|
|
|
@ -251,6 +251,42 @@
|
||||||
desc = "Vim cmd KeyMapping Test";
|
desc = "Vim cmd KeyMapping Test";
|
||||||
inherit mode;
|
inherit mode;
|
||||||
}
|
}
|
||||||
|
# Nested mapping
|
||||||
|
{
|
||||||
|
mode = [
|
||||||
|
"n"
|
||||||
|
"v"
|
||||||
|
];
|
||||||
|
__unkeyed-1 = [
|
||||||
|
{
|
||||||
|
__unkeyed-1 = "<leader>f";
|
||||||
|
group = "Group Test";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
__unkeyed-1 = "<leader>f<tab>";
|
||||||
|
group = "Group in Group Test";
|
||||||
|
}
|
||||||
|
];
|
||||||
|
}
|
||||||
|
# Create mapping
|
||||||
|
{
|
||||||
|
__unkeyed-1 = "<leader>cS";
|
||||||
|
__unkeyed-2 = "<cmd>CodeSnapSave<CR>";
|
||||||
|
mode = "v";
|
||||||
|
desc = "Save";
|
||||||
|
}
|
||||||
|
# Function mapping
|
||||||
|
{
|
||||||
|
__unkeyed-1 = "<leader>db";
|
||||||
|
__unkeyed-2.__raw = ''
|
||||||
|
function()
|
||||||
|
require("dap").toggle_breakpoint()
|
||||||
|
end
|
||||||
|
'';
|
||||||
|
mode = "n";
|
||||||
|
desc = "Breakpoint toggle";
|
||||||
|
silent = true;
|
||||||
|
}
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue