mirror of
https://github.com/NotAShelf/nvf.git
synced 2024-11-22 05:10:44 +00:00
neo-tree: move beforeAll to pluginRC
This commit is contained in:
parent
7f5c33605d
commit
c9f5dd1e22
1 changed files with 22 additions and 21 deletions
|
@ -4,7 +4,7 @@
|
|||
...
|
||||
}: let
|
||||
inherit (lib.modules) mkIf;
|
||||
inherit (lib.strings) optionalString;
|
||||
inherit (lib.nvim.dag) entryAnywhere;
|
||||
|
||||
cfg = config.vim.filetree.neo-tree;
|
||||
in {
|
||||
|
@ -22,30 +22,31 @@ in {
|
|||
setupModule = "neo-tree";
|
||||
inherit (cfg) setupOpts;
|
||||
|
||||
beforeAll =
|
||||
optionalString (cfg.setupOpts.filesystem.hijack_netrw_behavior != "disabled")
|
||||
# from https://github.com/nvim-neo-tree/neo-tree.nvim/discussions/1326
|
||||
''
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
group = vim.api.nvim_create_augroup("load_neo_tree", {}),
|
||||
desc = "Loads neo-tree when openning a directory",
|
||||
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,
|
||||
})
|
||||
'';
|
||||
cmd = ["Neotree"];
|
||||
event = [];
|
||||
};
|
||||
|
||||
pluginRC = mkIf (cfg.setupOpts.filesystem.hijack_netrw_behavior != "disabled" && config.vim.lazy.enable) {
|
||||
# from https://github.com/nvim-neo-tree/neo-tree.nvim/discussions/1326
|
||||
neo-tree = entryAnywhere ''
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
group = vim.api.nvim_create_augroup("load_neo_tree", {}),
|
||||
desc = "Loads neo-tree when openning a directory",
|
||||
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,
|
||||
})
|
||||
'';
|
||||
};
|
||||
|
||||
visuals.nvimWebDevicons.enable = true;
|
||||
};
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue