Compare commits

..

2 commits

2 changed files with 13 additions and 8 deletions

View file

@ -40,16 +40,17 @@ let
config = { config = {
lambda = lambda =
let let
fnArgs = builtins.listToAttrs (map (v: { name = v; value = raw v; }) config.args); inherit (builtins) listToAttrs attrValues;
fnArgs = listToAttrs (map (v: { name = v; value = raw v; }) config.args);
innerCfg = config.content fnArgs; innerCfg = config.content fnArgs;
in in
lambda config.args (lib.flatten [ lambda config.args (lib.flatten [
innerCfg.extra innerCfg.extra
# Autocommands
(map (v: v.genConfig) (attrValues innerCfg.vim.augroup))
# Keymaps
(lib.flip map innerCfg.vim.keymap.set ({ mode, lhs, rhs, ... } @ vars: (lib.flip map innerCfg.vim.keymap.set ({ mode, lhs, rhs, ... } @ vars:
let let m = if builtins.isList mode then lib.head mode else mode; in
m = if builtins.isList mode then lib.head mode else mode;
in
if innerCfg.vim.keymap._validate."${m}"."${lhs}" == rhs then vars.genConfig if innerCfg.vim.keymap._validate."${m}"."${lhs}" == rhs then vars.genConfig
else abort "This case should never happen." else abort "This case should never happen."
)) ))

View file

@ -133,10 +133,14 @@ in
} }
] ]
) ++ lib.optionals config.plugins.snippet.luasnip.enable ( ) ++ lib.optionals config.plugins.snippet.luasnip.enable (
let ls = pipe1 config.plugin.luasnip.var; in [ let
ls = pipe1 config.plugin.luasnip.var;
jump = dir: (if' (ls (call "locally_jumpable" dir)) (ls (call "jump" dir)));
in
[
{ mode = "i"; lhs = ctrl "K"; rhs = lambda0 (ls (call0 "expand")); silent = true; } { mode = "i"; lhs = ctrl "K"; rhs = lambda0 (ls (call0 "expand")); silent = true; }
{ mode = [ "i" "s" ]; lhs = ctrl "L"; rhs = lambda0 (ls (call "jump" 1)); silent = true; } { mode = [ "i" "s" ]; lhs = ctrl "L"; rhs = lambda0 (jump 1); silent = true; }
{ mode = [ "i" "s" ]; lhs = ctrl "H"; rhs = lambda0 (ls (call "jump" (- 1))); silent = true; } { mode = [ "i" "s" ]; lhs = ctrl "H"; rhs = lambda0 (jump (-1)); silent = true; }
{ {
mode = [ "i" "s" ]; mode = [ "i" "s" ];
lhs = ctrl "E"; lhs = ctrl "E";