modules/fn: fix using autocommands in the functions

This commit is contained in:
Dmitriy Pleshevskiy 2024-05-24 15:23:38 +03:00
parent a915557ced
commit 592f9251e5
Signed by: pleshevskiy
GPG key ID: 17041163DA10A9A2

View file

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