mirror of
https://github.com/NotAShelf/nvf.git
synced 2025-02-12 20:13:19 +00:00
Some checks are pending
Set up binary cache / cachix (default) (push) Waiting to run
Set up binary cache / cachix (maximal) (push) Waiting to run
Set up binary cache / cachix (nix) (push) Waiting to run
Validate flake & check formatting / Validate Flake (push) Waiting to run
Validate flake & check formatting / Formatting via Alejandra (push) Waiting to run
Build and deploy documentation / Check latest commit (push) Waiting to run
Build and deploy documentation / publish (push) Blocked by required conditions
Check for typos in the source tree / check-typos (push) Waiting to run
49 lines
936 B
Nix
49 lines
936 B
Nix
{
|
|
config,
|
|
lib,
|
|
...
|
|
}: let
|
|
inherit (lib.modules) mkIf mkMerge;
|
|
inherit (lib.trivial) pipe;
|
|
inherit (lib.attrsets) mapAttrsToList;
|
|
inherit (lib.lists) flatten;
|
|
|
|
legacyMapModes = {
|
|
normal = ["n"];
|
|
insert = ["i"];
|
|
select = ["s"];
|
|
visual = ["v"];
|
|
terminal = ["t"];
|
|
normalVisualOp = ["n" "v" "o"];
|
|
visualOnly = ["n" "x"];
|
|
operator = ["o"];
|
|
insertCommand = ["i" "c"];
|
|
lang = ["l"];
|
|
command = ["c"];
|
|
};
|
|
|
|
cfg = config.vim;
|
|
in {
|
|
config = {
|
|
vim.keymaps = mkMerge [
|
|
(
|
|
pipe cfg.maps
|
|
[
|
|
(mapAttrsToList (
|
|
oldMode: keybinds:
|
|
mapAttrsToList (
|
|
key: bind:
|
|
bind
|
|
// {
|
|
inherit key;
|
|
mode = legacyMapModes.${oldMode};
|
|
}
|
|
)
|
|
keybinds
|
|
))
|
|
flatten
|
|
]
|
|
)
|
|
];
|
|
};
|
|
}
|