nerdtree

A tree explorer plugin for vim.
Index Commits Files Refs
commit 2cbc76bbfd807f022031f8c789f66d105d0a5d0b
parent 347a58b0b0276958ccc5b2e7cf8edd9c9923906c
Author: Phil Runninger <PhilRunninger@users.noreply.github.com>
Date:   Thu, 27 Jun 2019 01:34:10 -0400

Fix NERDTree opening with the wrong size. (#1008)

* Fix NERDTree opening with the wrong size.

There were two commands that seemed to be causing the NERDTree window to
open in exactly half the screen width. They are:

- silent! execute 'edit ' . t:NERDTreeBufName        in _createTreeWin()
- setlocal nobuflisted                         in _setCommonBufOptions()

These commands were reseting the width of NERDTree. The solution I chose
was to resize the window after creating the new window, and then to set
winfixwidth before setting the other common buffer options.

* Update change log and version number.

Diffstat:
MCHANGELOG.md | 1+
Mautoload/nerdtree.vim | 2+-
Mlib/nerdtree/creator.vim | 4+++-
3 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
@@ -1,6 +1,7 @@
 # Change Log
 
 ### 5.1...
+- **`.2`**: Fix NERDTree opening with the wrong size. (@PhilRunninger) #1008
 - **`.1`**: Update Changelog and create PR Template (@PhilRunninger) #1007
 - **`.0`**: Too many changes for one patch...
     - Refresh a dir_node if the file wasn't found in it, and look once more. (@PhilRunninger) #1005
diff --git a/autoload/nerdtree.vim b/autoload/nerdtree.vim
@@ -4,7 +4,7 @@ endif
 let g:loaded_nerdtree_autoload = 1
 
 function! nerdtree#version()
-    return '5.1.1'
+    return '5.1.2'
 endfunction
 
 " SECTION: General Functions {{{1
diff --git a/lib/nerdtree/creator.vim b/lib/nerdtree/creator.vim
@@ -189,18 +189,20 @@ function! s:Creator._createTreeWin()
         let t:NERDTreeBufName = self._nextBufferName()
         silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' new'
         silent! execute 'edit ' . t:NERDTreeBufName
+        silent! execute 'vertical resize '. l:splitSize
     else
         silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' split'
         silent! execute 'buffer ' . t:NERDTreeBufName
     endif
 
+    setlocal winfixwidth
+
     call self._setCommonBufOptions()
 
     if has('patch-7.4.1925')
         clearjumps
     endif
 
-    setlocal winfixwidth
 endfunction
 
 " FUNCTION: s:Creator._isBufHidden(nr) {{{1