Compare commits
No commits in common. "bbf171f51bd2b7fb899b32a92c65bc08b64e30a4" and "6ce249fa026f172820889a60c7000cefd24867b3" have entirely different histories.
bbf171f51b
...
6ce249fa02
3 changed files with 4 additions and 36 deletions
|
@ -18,7 +18,7 @@ in
|
||||||
apply = x: assert (builtins.stringLength x == 1 || abort "<LocalLeader> `${x}` is longer than one character is not allowed"); x;
|
apply = x: assert (builtins.stringLength x == 1 || abort "<LocalLeader> `${x}` is longer than one character is not allowed"); x;
|
||||||
};
|
};
|
||||||
|
|
||||||
exMode.enable = mkEnableOption "Ex mode";
|
exMode.enable = (mkEnableOption "Ex mode") // { default = true; };
|
||||||
arrowKeys = {
|
arrowKeys = {
|
||||||
disable = mkOption {
|
disable = mkOption {
|
||||||
type = types.bool;
|
type = types.bool;
|
||||||
|
|
|
@ -1,42 +1,10 @@
|
||||||
{ config, lib, ... }:
|
{ lib, ... }:
|
||||||
|
|
||||||
let cfg = config.vim.keymap; in
|
|
||||||
{
|
{
|
||||||
options.vim.keymap = with lib; {
|
options.vim.keymap = with lib; {
|
||||||
_validate = mkOption {
|
|
||||||
# buffer mode lhs rhs
|
|
||||||
type = with types; attrsOf (attrsOf (attrsOf (either str attrs)));
|
|
||||||
visible = false;
|
|
||||||
internal = true;
|
|
||||||
readOnly = true;
|
|
||||||
};
|
|
||||||
set = mkOption {
|
set = mkOption {
|
||||||
type = with types; listOf keymap;
|
type = with types; listOf keymap;
|
||||||
default = [ ];
|
default = [ ];
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
config = {
|
|
||||||
vim.keymap._validate = lib.mkMerge
|
|
||||||
(map
|
|
||||||
({ mode, lhs, rhs, buffer, ... }:
|
|
||||||
let
|
|
||||||
sourceModes = if builtins.isList mode then mode else [ mode ];
|
|
||||||
unwrappedModes = lib.flatten (lib.flip map sourceModes (m:
|
|
||||||
if m == "" then [ "n" "x" "s" "o" ]
|
|
||||||
else if m == "!" then [ "i" "c" ]
|
|
||||||
else if m == "v" then [ "x" "s" ]
|
|
||||||
else if m == "l" then [ "i" "c" "l" ]
|
|
||||||
else m
|
|
||||||
));
|
|
||||||
|
|
||||||
buf = if buffer == null then "" else buffer;
|
|
||||||
in
|
|
||||||
lib.foldl lib.recursiveUpdate { }
|
|
||||||
(lib.flip map unwrappedModes (m: {
|
|
||||||
"${buf}"."${m}"."${lhs}" = rhs;
|
|
||||||
}))
|
|
||||||
)
|
|
||||||
cfg.set);
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue