neo-tree: move beforeAll to pluginRC

This commit is contained in:
Ching Pei Yang 2024-11-19 01:17:09 +01:00
parent 7f5c33605d
commit c9f5dd1e22
No known key found for this signature in database
GPG key ID: B3841364253DC4C8

View file

@ -4,7 +4,7 @@
... ...
}: let }: let
inherit (lib.modules) mkIf; inherit (lib.modules) mkIf;
inherit (lib.strings) optionalString; inherit (lib.nvim.dag) entryAnywhere;
cfg = config.vim.filetree.neo-tree; cfg = config.vim.filetree.neo-tree;
in { in {
@ -22,10 +22,13 @@ in {
setupModule = "neo-tree"; setupModule = "neo-tree";
inherit (cfg) setupOpts; inherit (cfg) setupOpts;
beforeAll = cmd = ["Neotree"];
optionalString (cfg.setupOpts.filesystem.hijack_netrw_behavior != "disabled") 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 # from https://github.com/nvim-neo-tree/neo-tree.nvim/discussions/1326
'' neo-tree = entryAnywhere ''
vim.api.nvim_create_autocmd("BufEnter", { vim.api.nvim_create_autocmd("BufEnter", {
group = vim.api.nvim_create_augroup("load_neo_tree", {}), group = vim.api.nvim_create_augroup("load_neo_tree", {}),
desc = "Loads neo-tree when openning a directory", desc = "Loads neo-tree when openning a directory",
@ -42,8 +45,6 @@ in {
end, end,
}) })
''; '';
cmd = ["Neotree"];
event = [];
}; };
visuals.nvimWebDevicons.enable = true; visuals.nvimWebDevicons.enable = true;