{ lib, ... }: { myvim.mkKey = rec { # set of functions that returns attrs for keymap list mkKeymap = mode: key: action: desc: { inherit mode key action; options = { inherit desc; silent = true; noremap = true; remap = true; }; }; # use when no description is to be passed mkKeymap' = mode: key: action: mkKeymap mode key action null; mkKeymapWithOpts = mode: key: action: desc: opts: (mkKeymap mode key action desc) // { options = opts; }; # for which-key icon generation # accepts a list of strings and returns a list of objects # [{ __unkeyed, icon, group, hidden }] wKeyObj = with builtins; list: { __unkeyed = elemAt list 0; icon = elemAt list 1; group = elemAt list 2; } // lib.optionalAttrs (length list > 3) { hidden = elemAt list 3; }; }; }