Skip to content

Commit

Permalink
refactor extra settings
Browse files Browse the repository at this point in the history
  • Loading branch information
khaneliman committed Dec 5, 2024
1 parent 9599ee4 commit adeebd3
Showing 1 changed file with 22 additions and 39 deletions.
61 changes: 22 additions & 39 deletions lib/neovim-plugin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -188,46 +188,29 @@
];
plugins.lz-n = lib.mkIf config.plugins.lz-n.enable {
plugins = [
{
__unkeyed-1 = originalName;
# Use provided after, otherwise fallback to normal lua content
after =
if cfg.lazyLoad.settings.after != null then
cfg.lazyLoad.settings.after
else
# We need to wrap it in a function so it doesn't execute immediately
"function()\n " + cfg.luaConfig.content + " \nend";
colorscheme =
if cfg.lazyLoad.settings.colorscheme != null then
cfg.lazyLoad.settings.colorscheme
else if (isColorscheme && colorscheme != null) then
colorscheme
else
null;

inherit (cfg.lazyLoad.settings)
enabled
priority
before
beforeAll
event
cmd
ft
keys
;
extraSettings = lib.removeAttrs cfg.lazyLoad.settings [
"enabled"
"priority"
"before"
"beforeAll"
"event"
"cmd"
"ft"
"keys"
"colorscheme"
(
{
__unkeyed-1 = originalName;
# Use provided after, otherwise fallback to normal lua content
after =
if cfg.lazyLoad.settings.after != null then
cfg.lazyLoad.settings.after
else
# We need to wrap it in a function so it doesn't execute immediately
"function()\n " + cfg.luaConfig.content + " \nend";
colorscheme =
if cfg.lazyLoad.settings.colorscheme != null then
cfg.lazyLoad.settings.colorscheme
else if (isColorscheme && colorscheme != null) then
colorscheme
else
null;
}
// (lib.removeAttrs cfg.lazyLoad.settings [
"after"
];
}
"colorscheme"
])
)
];
};
})
Expand Down

0 comments on commit adeebd3

Please sign in to comment.