From 14061c6db5188bd21279f1ddc4bb57962fff796f Mon Sep 17 00:00:00 2001 From: Pei Yang Ching <59727193+horriblename@users.noreply.github.com> Date: Wed, 24 Jul 2024 13:23:53 +0200 Subject: [PATCH] nvim-tree: use lazy --- modules/plugins/filetree/nvimtree/config.nix | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/plugins/filetree/nvimtree/config.nix b/modules/plugins/filetree/nvimtree/config.nix index b97b1e4..f1e75b5 100644 --- a/modules/plugins/filetree/nvimtree/config.nix +++ b/modules/plugins/filetree/nvimtree/config.nix @@ -16,8 +16,6 @@ inherit (self.options.vim.filetree.nvimTree) mappings; in { config = mkIf cfg.enable { - vim.startPlugins = ["nvim-tree-lua"]; - vim.maps.normal = mkMerge [ (mkBinding cfg.mappings.toggle ":NvimTreeToggle" mappings.toggle.description) (mkBinding cfg.mappings.refresh ":NvimTreeRefresh" mappings.refresh.description) @@ -29,6 +27,17 @@ in { "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 '' ${ optionalString cfg.setupOpts.disable_netrw '' @@ -38,8 +47,6 @@ in { '' } - require'nvim-tree'.setup(${toLuaObject cfg.setupOpts}) - ${ optionalString cfg.openOnSetup '' -- autostart behaviour