Skip to content

NERDTree will lose its width when the buffer next to it is closed #1152

Closed
@leighmcculloch

Description

@leighmcculloch

Self-Diagnosis

  • I have searched the issues for an answer to my question.
  • I have reviewed the NERDTree documentation. :h NERDTree
  • I have reviewed the Wiki.
  • I have searched the web for an answer to my question.

Environment (for bug reports)

  • Operating System: Debian Buster
  • Vim/Neovim version :echo v:version: 802
  • NERDTree version, found on 1st line in NERDTree quickhelp ?: 6.8.0
  • vimrc settings
    • NERDTree variables
    let g:NERDTreeWinSize = 31
    • Other NERDTree-dependent Plugins
      • jistr/vim-nerdtree-tabs
      • ryanoasis/vim-devicons
      • tiagofumo/vim-nerdtree-syntax-highlight
      • Xuyuanp/nerdtree-git-plugin
      • Others (specify):
    • I've verified the issue occurs with only NERDTree installed. [This issue occurs frequently when using tabs in the way that is supported by vim-airline. This might not be the traditional way to use tabs, but I think it is worth reporting.]

Steps to Reproduce the Issue

  1. Open multiples files in VIM.
    Screen Shot 2020-07-12 at 11 05 01 PM

  2. Toggle open NERDTree which opens on the left.
    Screen Shot 2020-07-12 at 11 05 14 PM

  3. Switch back to buffer on the right.
    Screen Shot 2020-07-12 at 11 05 24 PM

  4. Close buffer on the left with :bdelete.
    Screen Shot 2020-07-12 at 11 05 33 PM

  5. Switch to another open file.

Screen Shot 2020-07-12 at 11 05 43 PM

  1. Toggle open NERDTree which open on the left, using maximum width, leaving buffer that was open only a single column of text on right.

Screen Shot 2020-07-12 at 11 06 24 PM

Current Result (Include screenshots where appropriate.)

See the last screenshot above. The NERDTree buffer is open on the left but is using maximum width leaving only one column of text space on the right for the buffer that was open. I believe this logically makes sense because the NERDTree window changed size to the full width in step 4 when the buffer next to NERDTree was closed.

Expected Result

I expected NERDTree to retain its configured size when it is reopened, but I can also see a very valid expectation that the window retains its width whenever it is changed, so I'm not sure there's a clear direction.

I have managed to work around this for my workflow using: https://github.com/leighmcculloch/vim_dotfiles/blob/master/vimrc#L135

When I open NERDTree with NERDTreeFind, I call vertical resize 31 immediately afterwards. It fixes the issue for me resulting in step 6 from above looking like this:
Screen Shot 2020-07-12 at 11 05 52 PM

This issue may be related to #142 which was closed without much information or resolution. As my issue is more specific I've opened a new issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions