2024-07-14 18:30:12 +00:00
|
|
|
{
|
|
|
|
config,
|
|
|
|
lib,
|
|
|
|
...
|
|
|
|
}: let
|
|
|
|
inherit (lib.modules) mkIf;
|
2024-11-19 00:17:09 +00:00
|
|
|
inherit (lib.nvim.dag) entryAnywhere;
|
2024-07-14 18:30:12 +00:00
|
|
|
|
|
|
|
cfg = config.vim.filetree.neo-tree;
|
|
|
|
in {
|
|
|
|
config = mkIf cfg.enable {
|
|
|
|
vim = {
|
|
|
|
startPlugins = [
|
|
|
|
# dependencies
|
|
|
|
"plenary-nvim" # commons library
|
|
|
|
"image-nvim" # optional for image previews
|
|
|
|
"nui-nvim" # ui library
|
|
|
|
];
|
|
|
|
|
2024-11-04 15:50:50 +00:00
|
|
|
lazy.plugins.neo-tree-nvim = {
|
|
|
|
package = "neo-tree-nvim";
|
|
|
|
setupModule = "neo-tree";
|
|
|
|
inherit (cfg) setupOpts;
|
|
|
|
|
|
|
|
cmd = ["Neotree"];
|
|
|
|
};
|
2024-10-04 14:00:17 +00:00
|
|
|
|
2024-11-08 11:34:56 +00:00
|
|
|
visuals.nvim-web-devicons.enable = true;
|
2024-11-19 00:17:09 +00:00
|
|
|
# from https://github.com/nvim-neo-tree/neo-tree.nvim/discussions/1326
|
|
|
|
pluginRC.neo-tree =
|
|
|
|
mkIf (cfg.setupOpts.filesystem.hijack_netrw_behavior != "disabled" && config.vim.lazy.enable)
|
|
|
|
(entryAnywhere ''
|
|
|
|
vim.api.nvim_create_autocmd("BufEnter", {
|
|
|
|
group = vim.api.nvim_create_augroup("load_neo_tree", {}),
|
2024-11-26 07:36:39 +00:00
|
|
|
desc = "Loads neo-tree when opening a directory",
|
2024-11-19 00:17:09 +00:00
|
|
|
callback = function(args)
|
|
|
|
local stats = vim.uv.fs_stat(args.file)
|
|
|
|
|
|
|
|
if not stats or stats.type ~= "directory" then
|
|
|
|
return
|
|
|
|
end
|
|
|
|
|
|
|
|
require("lz.n").trigger_load("neo-tree-nvim")
|
|
|
|
|
|
|
|
return true
|
|
|
|
end,
|
|
|
|
})
|
|
|
|
'');
|
2024-07-14 18:30:12 +00:00
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|