mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-12-21 17:59:48 +01:00
b637f921d5
* mappings: add new keymap option * mappings: impl keymap option * doc: update release notes * map: fix misinformation * map: remove redundant variable * fixup! mappings: impl keymap option
77 lines
1.5 KiB
Nix
77 lines
1.5 KiB
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 [
|
|
(
|
|
mkIf cfg.disableArrows [
|
|
{
|
|
key = "<up>";
|
|
mode = ["n" "i"];
|
|
action = "<nop>";
|
|
noremap = false;
|
|
}
|
|
{
|
|
key = "<down>";
|
|
mode = ["n" "i"];
|
|
action = "<nop>";
|
|
noremap = false;
|
|
}
|
|
{
|
|
key = "<left>";
|
|
mode = ["n" "i"];
|
|
action = "<nop>";
|
|
noremap = false;
|
|
}
|
|
{
|
|
key = "<right>";
|
|
mode = ["n" "i"];
|
|
action = "<nop>";
|
|
noremap = false;
|
|
}
|
|
]
|
|
)
|
|
(
|
|
pipe cfg.maps
|
|
[
|
|
(mapAttrsToList (
|
|
oldMode: keybinds:
|
|
mapAttrsToList (
|
|
key: bind:
|
|
bind
|
|
// {
|
|
inherit key;
|
|
mode = legacyMapModes.${oldMode};
|
|
}
|
|
)
|
|
keybinds
|
|
))
|
|
flatten
|
|
]
|
|
)
|
|
];
|
|
};
|
|
}
|