Compare commits

...

5 commits

Author SHA1 Message Date
diniamo
8848fd08ea
Merge 554b36a4bf into ef413736e9 2024-10-07 05:43:11 +00:00
diniamo
554b36a4bf nvim-cmp: load after luasnip 2024-10-07 07:43:06 +02:00
raf
ef413736e9
Merge branch 'main' into v0.7 2024-10-07 00:40:13 +00:00
Ching Pei Yang
e77632e4eb
lib: remove pointless type restriction (#408)
Some checks failed
Set up binary cache / cachix (default) (push) Has been cancelled
Set up binary cache / cachix (maximal) (push) Has been cancelled
Set up binary cache / cachix (nix) (push) Has been cancelled
Validate flake & check formatting / Validate Flake (push) Has been cancelled
Validate flake & check formatting / Formatting via Alejandra (push) Has been cancelled
2024-10-06 23:19:39 +00:00
Ching Pei Yang
b39b84490f
Docs/map rewrite (#403)
* doc: fix formatting

* docs: update keymaps section
2024-10-06 14:03:21 +00:00
4 changed files with 12 additions and 23 deletions

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

@ -97,7 +97,7 @@ in {
default = {};
type = submodule {
freeformType = attrsOf anything;
freeformType = anything;
options = opts;
};
};

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'';
};
};
};

View file

@ -44,7 +44,7 @@ in {
formatting.format = cfg.format;
};
pluginRC.nvim-cmp = mkIf cfg.enable (entryAfter ["autopairs"] ''
pluginRC.nvim-cmp = mkIf cfg.enable (entryAfter ["autopairs" "luasnip"] ''
local luasnip = require("luasnip")
local cmp = require("cmp")
cmp.setup(${toLuaObject cfg.setupOpts})