From 2cbc76bbfd807f022031f8c789f66d105d0a5d0b Mon Sep 17 00:00:00 2001 From: Phil Runninger Date: Thu, 27 Jun 2019 01:34:10 -0400 Subject: [PATCH] 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. --- CHANGELOG.md | 1 + autoload/nerdtree.vim | 2 +- lib/nerdtree/creator.vim | 4 +++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec6b35d..6b98977 100644 --- 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 index d7d428d..845f920 100644 --- 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 index 5eac168..987e02e 100644 --- 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