mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-23 05:40:44 +00:00
lib: add mkSetLuaBinding
This commit is contained in:
parent
eeb54209e2
commit
767407a7d4
1 changed files with 7 additions and 12 deletions
|
@ -3,6 +3,7 @@
|
||||||
inherit (lib.modules) mkIf mkDefault;
|
inherit (lib.modules) mkIf mkDefault;
|
||||||
inherit (lib.types) nullOr str;
|
inherit (lib.types) nullOr str;
|
||||||
inherit (lib.attrsets) isAttrs mapAttrs;
|
inherit (lib.attrsets) isAttrs mapAttrs;
|
||||||
|
inherit (lib.generators) mkLuaInline;
|
||||||
|
|
||||||
binds = rec {
|
binds = rec {
|
||||||
mkLuaBinding = key: action: desc:
|
mkLuaBinding = key: action: desc:
|
||||||
|
@ -72,23 +73,17 @@
|
||||||
inherit mode lhs rhs desc;
|
inherit mode lhs rhs desc;
|
||||||
};
|
};
|
||||||
|
|
||||||
# Usage:
|
|
||||||
#
|
|
||||||
# ```
|
|
||||||
# vim.lazy.plugins = {
|
|
||||||
# telescope = {
|
|
||||||
# # ...
|
|
||||||
# keys = builtins.filter ({lhs, ...}: lhs != null) [
|
|
||||||
# mkSetLznBinding mapping ":Telescope<CR>"
|
|
||||||
# ];
|
|
||||||
# }
|
|
||||||
# }
|
|
||||||
# ```
|
|
||||||
mkSetLznBinding = binding: action: {
|
mkSetLznBinding = binding: action: {
|
||||||
lhs = binding.value;
|
lhs = binding.value;
|
||||||
rhs = action;
|
rhs = action;
|
||||||
desc = binding.description;
|
desc = binding.description;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
mkSetLuaLznBinding = binding: action: {
|
||||||
|
lhs = binding.value;
|
||||||
|
rhs = mkLuaInline "function() ${action} end";
|
||||||
|
desc = binding.description;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
in
|
in
|
||||||
binds
|
binds
|
||||||
|
|
Loading…
Reference in a new issue