Open glepnir opened 3 years ago
Hmm 🤔 @glepnir I have a very similar config i.e
use "kyazdani42/nvim-web-devicons"
use {
"kyazdani42/nvim-tree.lua",
cmd = "NvimTreeOpen",
keys = "<c-n>",
config = conf("nvim-tree"),
requires = "nvim-web-devicons"
}
And that loads on demand. Regarding the plugin file, in this case packer I think doesn't have to do any special loading of the plugin
file vim handles this automatically when packadd-ing the file. Have you tried it with a minimal init.lua
to see if there's anything else getting in the way?
It works before. yup if we add the plugin to data path or rtp .vim will load plugin/*.vim. but infact when i first press command I got empty buffer..
@glepnir Any chance you know what commit of nvim-tree
was last working for you? @akinsho is correct; packadd
should source everything in a plugin's plugin/
directory.
If you run :verbose autocmd NvimTree
after trying to load the plugin, what output do you get?
it will show like this. because the nvim-tree need a bufenter event in it's autogroup. so when i first to load nvim tree this group not load.
::verbose autocmd NvimTree
--- Autocommands ---
NvimTree BufEnter
* lua require'nvim-tree'.buf_enter()
Last set from ~/.local/share/nvim/site/pack/packer/opt/nvim-tree.lua/plugin/tree.vim
line 19
NvimTree BufWritePost
* lua require'nvim-tree'.refresh()
Last set from ~/.local/share/nvim/site/pack/packer/opt/nvim-tree.lua/plugin/tree.vim
line 15
NvimTree ColorScheme
* lua require'nvim-tree'.reset_highlight()
Last set from ~/.local/share/nvim/site/pack/packer/opt/nvim-tree.lua/plugin/tree.vim
line 23
NvimTree User
FugitiveChanged
lua require'nvim-tree'.refresh()
Last set from ~/.local/share/nvim/site/pack/packer/opt/nvim-tree.lua/plugin/tree.vim
line 24
Right - the confusing fact here is that the BufEnter
autocommand should be in place before the buffer gets opened. We load the plugin by, in order:
packadd the-plugin
So creating the autocommand should happen in step (2) before being required in step (5). @glepnir, do you know what was the last working commit for you?
As an FYI I believe this is an issue that should be discussed at nvim-tree
rather than here as there has been a refactor to how it works that means the plugin behaves differently than you'd expect. It is discussed over in the issue below. The TLDR is that a user now has to add an extra call for it to work via lazy loading. I don't think this is due to some bug in packer rather a design decision in nvim-tree
@akinsho Hey there. update the all things just now. nvim tree can't work when first open. the buffer is empty of nvimtree. seems like the plugin/tree.vim not load ?
nvim tree need this augroup. when lazyload the nvim-tree. it not load when press command before