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: Opener._newVSplit() {{{1
function! s:Opener._newVSplit() function! s:Opener._newVSplit()
let winwidth = winwidth(".") let l:winwidth = winwidth('.')
if winnr("$")==#1
let winwidth = g:NERDTreeWinSize if winnr('$') == 1
let l:winwidth = g:NERDTreeWinSize
endif endif
call nerdtree#exec("wincmd p") call nerdtree#exec('wincmd p')
vnew 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() call g:NERDTree.CursorToTreeWin()
exec("silent vertical resize ". winwidth) execute 'silent vertical resize ' . l:winwidth
exe currentWin . "wincmd w"
call nerdtree#exec(l:currentWindowNumber . 'wincmd w')
endfunction endfunction
" FUNCTION: Opener.open(target) {{{1 " FUNCTION: Opener.open(target) {{{1