Skip to content

Calling :LuaTreeToggle creates empty buffers when "hidden" is set #2

Closed
@nanotee

Description

@nanotee
OS: Ubuntu 18.04
terminal: Gnome Terminal
nvim: NVIM v0.5.0-392-gff1730373

Steps to reproduce using nvim -u NORC

In any buffer, set the following option:

:set hidden

Then, call :LuaTreeToggle a few times. When inspecting the buffer list, this is the result:

:buffers                                                                                   
  1 %a   "[No Name]"                    line 1
  4  h   "[No Name]"                    line 1
  6  h   "[No Name]"                    line 1
  8  h   "[No Name]"                    line 1
 10  h   "[No Name]"                    line 1
Press ENTER or type command to continue

After investigating the issue a bit, it seems to come from this line:
https://github.com/kyazdani42/nvim-tree.lua/blob/7e3ff3db86effd9901448ff8d553af71526e979a/lua/lib/winutils.lua#L69

According to the documentation, :new opens a new window with an empty file in it, hence why the buffer isn't discarded. Using :vsplit instead seems to fix the bug, but I'm not familiar enough with (Neo)vim's quirks to know whether this causes other undesirable side effects.

Thanks for the cool plugin by the way, it has nice defaults and works really well out of the box :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions