Refactor the internals of "_newVSplit()"

The previous change to this function was simple. I figured that it
would be a good time to improve the style of this function with some
minor edits. The function is now cleaner and more readable.
This commit is contained in:
Jason Franklin 2017-07-29 08:55:28 -04:00
parent 719d6785d4
commit 35724ee206

View File

@ -222,20 +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
let currentWin = winnr()
let l:currentWindowNumber = winnr()
"resize the nerd tree back to the original size
" Restore the NERDTree to its original width.
call g:NERDTree.CursorToTreeWin()
exec("silent vertical resize ". winwidth)
exe currentWin . "wincmd w"
execute 'silent vertical resize ' . l:winwidth
call nerdtree#exec(l:currentWindowNumber . 'wincmd w')
endfunction
" FUNCTION: Opener.open(target) {{{1