Merge pull request #729 from ParkerKemp/master

Change windows using window number when opening in new vertical
split.
This commit is contained in:
Jason Franklin 2017-07-29 09:04:44 -04:00 committed by GitHub
commit 5af263c2df

View File

@ -1,5 +1,10 @@
" ============================================================================
" CLASS: Opener
"============================================================
"
" The Opener class defines an API for "opening" operations.
" ============================================================================
let s:Opener = {}
let g:NERDTreeOpener = s:Opener
@ -26,6 +31,7 @@ function! s:Opener._bufInWindows(bnum)
return cnt
endfunction
" FUNCTION: Opener._checkToCloseTree(newtab) {{{1
" Check the class options and global options (i.e. NERDTreeQuitOnOpen) to see
" if the tree should be closed now.
@ -44,7 +50,6 @@ function! s:Opener._checkToCloseTree(newtab)
endif
endfunction
" FUNCTION: s:Opener._firstUsableWindow() {{{1
" find the window number of the first normal window
function! s:Opener._firstUsableWindow()
@ -217,18 +222,22 @@ endfunction
" FUNCTION: Opener._newVSplit() {{{1
function! s:Opener._newVSplit()
let winwidth = winwidth(".")
if winnr("$")==#1
let winwidth = g:NERDTreeWinSize
let l:winwidth = winwidth('.')
if winnr('$') == 1
let l:winwidth = g:NERDTreeWinSize
endif
call nerdtree#exec("wincmd p")
call nerdtree#exec('wincmd p')
vnew
"resize the nerd tree back to the original size
let l:currentWindowNumber = winnr()
" Restore the NERDTree to its original width.
call g:NERDTree.CursorToTreeWin()
exec("silent vertical resize ". winwidth)
call nerdtree#exec('wincmd p')
execute 'silent vertical resize ' . l:winwidth
call nerdtree#exec(l:currentWindowNumber . 'wincmd w')
endfunction
" FUNCTION: Opener.open(target) {{{1