mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-09 14:45:58 +01:00
Compare commits
4 commits
275f78f683
...
269d574720
Author | SHA1 | Date | |
---|---|---|---|
|
269d574720 | ||
|
c7df5c97f3 | ||
|
e086dc02fe | ||
|
fc58c85524 |
2 changed files with 42 additions and 9 deletions
|
@ -71,6 +71,24 @@
|
|||
mkLznBinding = 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: {
|
||||
lhs = binding.value;
|
||||
rhs = action;
|
||||
desc = binding.description;
|
||||
};
|
||||
};
|
||||
in
|
||||
binds
|
||||
|
|
|
@ -31,15 +31,30 @@
|
|||
(removeAttrs spec ["package" "setupModule" "setupOpts" "keys"])
|
||||
// {
|
||||
"@1" = name;
|
||||
after = mkLuaInline ''
|
||||
function()
|
||||
${
|
||||
optionalString (spec.setupModule != null)
|
||||
"require(${toJSON spec.setupModule}).setup(${toLuaObject spec.setupOpts})"
|
||||
}
|
||||
${optionalString (spec.after != null) spec.after}
|
||||
end
|
||||
'';
|
||||
before =
|
||||
if spec.before != null
|
||||
then
|
||||
mkLuaInline ''
|
||||
function()
|
||||
${spec.before}
|
||||
end
|
||||
''
|
||||
else null;
|
||||
|
||||
after =
|
||||
if spec.setupModule == null && spec.after == null
|
||||
then null
|
||||
else
|
||||
mkLuaInline ''
|
||||
function()
|
||||
${
|
||||
optionalString (spec.setupModule != null)
|
||||
"require(${toJSON spec.setupModule}).setup(${toLuaObject spec.setupOpts})"
|
||||
}
|
||||
${optionalString (spec.after != null) spec.after}
|
||||
end
|
||||
'';
|
||||
|
||||
keys =
|
||||
if typeOf spec.keys == "list" && length spec.keys > 0 && typeOf (head spec.keys) == "set"
|
||||
then map toLuzLznKeySpec spec.keys
|
||||
|
|
Loading…
Reference in a new issue