Closed devansh08 closed 8 months ago
Directories defined in the config
expand_all.exclude
should not expand when a file under them is opened without interacting with the tree (using something like:e
or via some other plugin)
You probably misunderstood the option here: expand_all.exclude
only applies when require("nvim-tree.api").tree.expand_all()
gets called. In your case the directory is expanded because you are editing a file inside it. Right now I don't think there is an option to disable this behavior, but maybe we can add it in actions.open_file
.
My workflow for this case is to just hide undesirables. Opening the commit message is indeed annoying.
filters = {
custom = {
"^.git$",
"^\\~formatter",
},
},
@Akmadan23 I'm happy to leave ones like these open but change them to "PR Please" feature requests.
It's an odd use case, but it is something that cannot be done via API.
Proposal:
*nvim-tree.update_focused_file.exclude*
List of vim regex directories and files to exclude from focus.
File name matches will not be focused.
Directory absolute path matches will not be focused.
Type: `string[]`, Default: `{}`
Description
I've setup a few directories under the
expand_all.exclude
table and I'm expecting if any files under those directories are opened, without interacting with the tree, their nodes should not auto expand/open.For example, I have
.git
in the table and when I usevim-fugitive
to commit, it opens the.git/COMMIT_EDITMSG
file. This expands the.git
directory in the tree, which should not happening (if I understand the docs correctly).Neovim version
Operating system and version
Linux arch 6.5.5-arch1-1
nvim-tree version
7dcda5d
Clean room replication
Steps to reproduce
.git
ordist
(based on my config above) directories (or create them with some files)nvim -nu /tmp/nvt-min.lua
:NvimTreeOpen
(all directories collapsed):e dist/temp
or:e .git/COMMIT_EDITMSG
.git
ordist
directory auto expandsExpected behavior
Directories defined in the config
expand_all.exclude
should not expand when a file under them is opened without interacting with the tree (using something like:e
or via some other plugin)Actual behavior
Excluded directories still expand