mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-25 04:39:47 +01:00
Docs/map rewrite (#403)
* doc: fix formatting * docs: update keymaps section
This commit is contained in:
parent
7a8b95cf7c
commit
b39b84490f
2 changed files with 10 additions and 21 deletions
|
@ -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
|
||||
|
|
|
@ -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'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue