1
0
Fork 0
mirror of https://github.com/NotAShelf/neovim-flake.git synced 2024-12-25 01:09:49 +01:00

Docs/map rewrite ()

* doc: fix formatting

* docs: update keymaps section
This commit is contained in:
Ching Pei Yang 2024-10-06 16:03:21 +02:00 committed by GitHub
parent 7a8b95cf7c
commit b39b84490f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 10 additions and 21 deletions
docs/manual/hacking
modules/neovim/mappings

View file

@ -7,37 +7,26 @@ section contains a general overview to how you may utilize said functions.
## Custom Key Mappings Support for a Plugin {#sec-custom-key-mappings}
To set a mapping, you should define it in `vim.maps.<<mode>>`.
The available modes are:
- normal
- insert
- select
- visual
- terminal
- normalVisualOp
- visualOnly
- operator
- insertCommand
- lang
- command
To set a mapping, you should define it in `vim.keymaps`.
An example, simple keybinding, can look like this:
```nix
{
vim.maps.normal = {
"<leader>wq" = {
vim.keymaps = [
{
key = "<leader>wq";
mode = ["n"];
action = ":wq<CR>";
silent = true;
desc = "Save file and quit";
};
};
}
];
}
```
There are many settings available in the options. Please refer to the
[documentation](https://notashelf.github.io/nvf/options.html#opt-vim.maps.command._name_.action)
[documentation](https://notashelf.github.io/nvf/options.html#opt-vim.keymaps)
to see a list of them.
**nvf** provides a list of helper commands, so that you don't have to write the

View file

@ -1,5 +1,5 @@
{lib, ...}: let
inherit (lib.options) mkOption;
inherit (lib.options) mkOption literalMD;
inherit (lib.types) either str listOf attrsOf nullOr submodule;
inherit (lib.nvim.config) mkBool;
@ -42,7 +42,7 @@
See `:help map-modes` for a list of modes.
'';
example = ''`["n" "v" "c"]` for normal, visual and command mode'';
example = literalMD ''`["n" "v" "c"]` for normal, visual and command mode'';
};
};
};