mirror of
https://github.com/NotAShelf/neovim-flake.git
synced 2024-11-12 23:15:58 +01:00
Compare commits
No commits in common. "5b8414a6a6c22e3e87146629d3d448a2355d0333" and "c97476bd3efc4665829e3301abaf5500fce1e97c" have entirely different histories.
5b8414a6a6
...
c97476bd3e
4 changed files with 11 additions and 46 deletions
|
@ -65,27 +65,10 @@
|
||||||
# type= str;
|
# type= str;
|
||||||
# }
|
# }
|
||||||
|
|
||||||
# Non-lz.n options
|
|
||||||
|
|
||||||
package = mkOption {
|
package = mkOption {
|
||||||
type = pluginType;
|
type = pluginType;
|
||||||
description = "Plugin package";
|
|
||||||
};
|
};
|
||||||
|
|
||||||
setupModule = mkOption {
|
|
||||||
type = nullOr str;
|
|
||||||
description = "Lua module to run setup function on.";
|
|
||||||
default = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
setupOpts = mkOption {
|
|
||||||
type = submodule {freeformType = attrsOf anything;};
|
|
||||||
description = "Options to pass to the setup function";
|
|
||||||
default = {};
|
|
||||||
};
|
|
||||||
|
|
||||||
# lz.n options
|
|
||||||
|
|
||||||
before = mkOption {
|
before = mkOption {
|
||||||
type = nullOr luaInline;
|
type = nullOr luaInline;
|
||||||
description = "Code to run before plugin is loaded";
|
description = "Code to run before plugin is loaded";
|
||||||
|
|
|
@ -88,7 +88,10 @@ inputs: {
|
||||||
|
|
||||||
# built (or "normalized") plugins that are modified
|
# built (or "normalized") plugins that are modified
|
||||||
builtStartPlugins = buildConfigPlugins vimOptions.startPlugins;
|
builtStartPlugins = buildConfigPlugins vimOptions.startPlugins;
|
||||||
builtOptPlugins = map (package: package // {optional = true;}) (buildConfigPlugins vimOptions.optPlugins);
|
builtOptPlugins = map (package: {
|
||||||
|
plugin = package;
|
||||||
|
optional = true;
|
||||||
|
}) (buildConfigPlugins vimOptions.optPlugins);
|
||||||
|
|
||||||
# additional Lua and Python3 packages, mapped to their respective functions
|
# additional Lua and Python3 packages, mapped to their respective functions
|
||||||
# to conform to the format makeNeovimConfig expects. end user should
|
# to conform to the format makeNeovimConfig expects. end user should
|
||||||
|
|
|
@ -16,6 +16,8 @@
|
||||||
inherit (self.options.vim.filetree.nvimTree) mappings;
|
inherit (self.options.vim.filetree.nvimTree) mappings;
|
||||||
in {
|
in {
|
||||||
config = mkIf cfg.enable {
|
config = mkIf cfg.enable {
|
||||||
|
vim.startPlugins = ["nvim-tree-lua"];
|
||||||
|
|
||||||
vim.maps.normal = mkMerge [
|
vim.maps.normal = mkMerge [
|
||||||
(mkBinding cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description)
|
(mkBinding cfg.mappings.toggle ":NvimTreeToggle<cr>" mappings.toggle.description)
|
||||||
(mkBinding cfg.mappings.refresh ":NvimTreeRefresh<cr>" mappings.refresh.description)
|
(mkBinding cfg.mappings.refresh ":NvimTreeRefresh<cr>" mappings.refresh.description)
|
||||||
|
@ -27,17 +29,6 @@ in {
|
||||||
"<leader>t" = "+NvimTree";
|
"<leader>t" = "+NvimTree";
|
||||||
};
|
};
|
||||||
|
|
||||||
vim.lazy = {
|
|
||||||
plugins = {
|
|
||||||
nvim-tree-lua = {
|
|
||||||
package = "nvim-tree-lua";
|
|
||||||
setupModule = "nvim-tree";
|
|
||||||
inherit (cfg) setupOpts;
|
|
||||||
cmd = ["NvimTreeClipboard" "NvimTreeClose" "NvimTreeCollapse" "NvimTreeCollapseKeepBuffers" "NvimTreeFindFile" "NvimTreeFindFileToggle" "NvimTreeFocus" "NvimTreeHiTest" "NvimTreeOpen" "NvimTreeRefresh" "NvimTreeResize" "NvimTreeToggle"];
|
|
||||||
};
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
vim.pluginRC.nvimtreelua = entryAnywhere ''
|
vim.pluginRC.nvimtreelua = entryAnywhere ''
|
||||||
${
|
${
|
||||||
optionalString cfg.setupOpts.disable_netrw ''
|
optionalString cfg.setupOpts.disable_netrw ''
|
||||||
|
@ -47,6 +38,8 @@ in {
|
||||||
''
|
''
|
||||||
}
|
}
|
||||||
|
|
||||||
|
require'nvim-tree'.setup(${toLuaObject cfg.setupOpts})
|
||||||
|
|
||||||
${
|
${
|
||||||
optionalString cfg.openOnSetup ''
|
optionalString cfg.openOnSetup ''
|
||||||
-- autostart behaviour
|
-- autostart behaviour
|
||||||
|
|
|
@ -3,29 +3,15 @@
|
||||||
config,
|
config,
|
||||||
...
|
...
|
||||||
}: let
|
}: let
|
||||||
inherit (builtins) toJSON;
|
|
||||||
inherit (lib.modules) mkIf;
|
inherit (lib.modules) mkIf;
|
||||||
inherit (lib.attrsets) mapAttrsToList;
|
inherit (lib.attrsets) mapAttrsToList;
|
||||||
inherit (lib.generators) mkLuaInline;
|
|
||||||
inherit (lib.strings) optionalString;
|
|
||||||
inherit (lib.nvim.lua) toLuaObject;
|
inherit (lib.nvim.lua) toLuaObject;
|
||||||
inherit (lib.nvim.dag) entryAnywhere;
|
inherit (lib.nvim.dag) entryAnywhere;
|
||||||
cfg = config.vim.lazy;
|
cfg = config.vim.lazy;
|
||||||
|
|
||||||
toLuaLznSpec = name: spec:
|
toLuaLznSpec = name: plugin:
|
||||||
(removeAttrs spec ["package" "setupModule" "setupOpts"])
|
(removeAttrs plugin ["package"])
|
||||||
// {
|
// {"@1" = name;};
|
||||||
"@1" = name;
|
|
||||||
after = mkLuaInline ''
|
|
||||||
function()
|
|
||||||
${
|
|
||||||
optionalString (spec.setupModule != null)
|
|
||||||
"require(${toJSON spec.setupModule}).setup(${toLuaObject spec.setupOpts})"
|
|
||||||
}
|
|
||||||
${optionalString (spec.after != null) spec.after}
|
|
||||||
end
|
|
||||||
'';
|
|
||||||
};
|
|
||||||
lznSpecs = mapAttrsToList toLuaLznSpec cfg.plugins;
|
lznSpecs = mapAttrsToList toLuaLznSpec cfg.plugins;
|
||||||
in {
|
in {
|
||||||
config.vim = mkIf cfg.enable {
|
config.vim = mkIf cfg.enable {
|
||||||
|
|
Loading…
Reference in a new issue