Closed
Description
Description
I followed the instructions to open the tree at startup when the argument is a directory.
I've been trying to clear the status line in the tree window. It seems the way to do this is to subscribe to the TreeOpen
event. This works when toggling the tree window with a key binding but not at startup.
I wonder if it's because it isn't attached to the event right away.
Neovim version
NVIM v0.8.3
Build type: RelWithDebInfo
LuaJIT 2.1.0-beta3
Operating system and version
Ubuntu 22.04
nvim-tree version
Minimal config
local api = require('nvim-tree.api')
require('nvim-tree').setup()
api.events.subscribe(api.events.Event.TreeOpen, function ()
print('TreeOpen happened')
end)
vim.api.nvim_create_autocmd('VimEnter', {
group = vim.api.nvim_create_augroup('nvim_tree_open', {}),
callback = function (ctx)
print('VimEnter happened')
if vim.fn.isdirectory(ctx.file) == 1 then
api.tree.open({path = ctx.file})
end
end
})
Steps to reproduce
- Start nvim with a directory argument, e.g.
nvim ~
. - Check output of
:messages
Expected behavior
VimEnter
and TreeOpen
messages should appear in the log.
Actual behavior
Only VimEnter
message appears in the log.