From e87dbfbd7205ba0672f18e3b946112ec85fcddf8 Mon Sep 17 00:00:00 2001 From: Price Hiller Date: Tue, 27 Feb 2024 03:25:12 -0600 Subject: [PATCH] =?UTF-8?q?fix(nvim):=20lazy=20load=20neo-tree=20for=20rea?= =?UTF-8?q?l=20this=20time=20=F0=9F=99=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dots/.config/nvim/lua/plugins/configs/neo-tree.lua | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/dots/.config/nvim/lua/plugins/configs/neo-tree.lua b/dots/.config/nvim/lua/plugins/configs/neo-tree.lua index 0b0bf81e..7d2e695e 100644 --- a/dots/.config/nvim/lua/plugins/configs/neo-tree.lua +++ b/dots/.config/nvim/lua/plugins/configs/neo-tree.lua @@ -1,3 +1,5 @@ +vim.g.loaded_netrwPlugin = 1 +vim.g.loaded_netrw = 1 return { { "nvim-neo-tree/neo-tree.nvim", @@ -15,11 +17,10 @@ return { -- Correctly hijack netrw, thanks to -- https://github.com/nvim-neo-tree/neo-tree.nvim/issues/1247#issuecomment-1836294271 vim.api.nvim_create_autocmd("BufEnter", { - once = true, - callback = function() - local f = vim.fn.expand("%:p") - local isdir = vim.fn.isdirectory(f) - if isdir == 1 or f == "" then + desc = "Lazy loads neo-tree when opening a directory", + callback = function(args) + local stats = vim.uv.fs_stat(args.file) + if stats and stats.type == "directory" then require("neo-tree") return true end @@ -48,7 +49,7 @@ return { }, { source = "remote", - display_name = " Remote" + display_name = " Remote", }, }, },