mirror of
https://github.com/nix-community/nixvim.git
synced 2025-06-21 08:35:43 +02:00
parent
da7c6c41ef
commit
7a952a4e32
1 changed files with 42 additions and 0 deletions
|
@ -45,3 +45,45 @@ When using NixVim it is possible to encounter an error of the type `attribute 'n
|
||||||
This usually means one of two things:
|
This usually means one of two things:
|
||||||
- The nixpkgs version is not in line with NixVim (for example nixpkgs nixos-23.11 is used with NixVim master)
|
- The nixpkgs version is not in line with NixVim (for example nixpkgs nixos-23.11 is used with NixVim master)
|
||||||
- The nixpkgs unstable version used with NixVim is not recent enough.
|
- The nixpkgs unstable version used with NixVim is not recent enough.
|
||||||
|
|
||||||
|
## How do I create multiple aliases for a single keymap
|
||||||
|
|
||||||
|
You could use the builtin [`map`] function (or similar) to do something like this:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
keymaps =
|
||||||
|
(builtins.map (key: {
|
||||||
|
inherit key;
|
||||||
|
action = "<some-action>";
|
||||||
|
options.desc = "My cool keymapping";
|
||||||
|
}) ["<key-1>" "<key-2>" "<key-3>"])
|
||||||
|
++ [
|
||||||
|
# Other keymaps...
|
||||||
|
];
|
||||||
|
```
|
||||||
|
|
||||||
|
This maps a list of keys into a list of similar [`keymaps`]. It is equivalent to:
|
||||||
|
|
||||||
|
```nix
|
||||||
|
keymaps = [
|
||||||
|
{
|
||||||
|
key = "<key-1>";
|
||||||
|
action = "<some-action>";
|
||||||
|
options.desc = "My cool keymapping";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<key-2>";
|
||||||
|
action = "<some-action>";
|
||||||
|
options.desc = "My cool keymapping";
|
||||||
|
}
|
||||||
|
{
|
||||||
|
key = "<key-3>";
|
||||||
|
action = "<some-action>";
|
||||||
|
options.desc = "My cool keymapping";
|
||||||
|
}
|
||||||
|
# Other keymaps...
|
||||||
|
];
|
||||||
|
```
|
||||||
|
|
||||||
|
[`map`]: https://nixos.org/manual/nix/stable/language/builtins#builtins-map
|
||||||
|
[`keymaps`]: ../keymaps
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue