diff --git a/doc/nvim-tree-lua.txt b/doc/nvim-tree-lua.txt index 9028c632..0e593286 100644 --- a/doc/nvim-tree-lua.txt +++ b/doc/nvim-tree-lua.txt @@ -124,8 +124,8 @@ Default is 0 |g:lua_tree_auto_open| *g:lua_tree_auto_open* -Can be `0` or `1`. When `1`, will bind |VimEnter| to automatically -open tree on startup if no files are specified. +Can be `0` or `1`. When `1`, will open the tree when the package is loaded. +It's not relying on VimEnter anymore. Default is 0 |g:lua_tree_auto_close| *g:lua_tree_auto_close* diff --git a/lua/tree.lua b/lua/tree.lua index 4bcfda90..7e8a9d8f 100644 --- a/lua/tree.lua +++ b/lua/tree.lua @@ -196,4 +196,6 @@ function M.xdg_open() end)) end +M.on_enter() + return M diff --git a/plugin/tree.vim b/plugin/tree.vim index 4935bb9a..911e1508 100644 --- a/plugin/tree.vim +++ b/plugin/tree.vim @@ -14,7 +14,6 @@ augroup LuaTree if get(g:, 'lua_tree_auto_close') == 1 au WinClosed * lua require'tree'.on_leave() endif - au VimEnter * lua require'tree'.on_enter() au ColorScheme * lua require'tree'.reset_highlight() au User FugitiveChanged lua require'tree'.refresh() if get(g:, 'lua_tree_tab_open') == 1