Merge pull request #729 from ParkerKemp/master
Change windows using window number when opening in new vertical split.
This commit is contained in:
commit
5af263c2df
@ -1,5 +1,10 @@
|
|||||||
|
" ============================================================================
|
||||||
" CLASS: Opener
|
" CLASS: Opener
|
||||||
"============================================================
|
"
|
||||||
|
" The Opener class defines an API for "opening" operations.
|
||||||
|
" ============================================================================
|
||||||
|
|
||||||
|
|
||||||
let s:Opener = {}
|
let s:Opener = {}
|
||||||
let g:NERDTreeOpener = s:Opener
|
let g:NERDTreeOpener = s:Opener
|
||||||
|
|
||||||
@ -26,6 +31,7 @@ function! s:Opener._bufInWindows(bnum)
|
|||||||
|
|
||||||
return cnt
|
return cnt
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Opener._checkToCloseTree(newtab) {{{1
|
" FUNCTION: Opener._checkToCloseTree(newtab) {{{1
|
||||||
" Check the class options and global options (i.e. NERDTreeQuitOnOpen) to see
|
" Check the class options and global options (i.e. NERDTreeQuitOnOpen) to see
|
||||||
" if the tree should be closed now.
|
" if the tree should be closed now.
|
||||||
@ -44,7 +50,6 @@ function! s:Opener._checkToCloseTree(newtab)
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
" FUNCTION: s:Opener._firstUsableWindow() {{{1
|
" FUNCTION: s:Opener._firstUsableWindow() {{{1
|
||||||
" find the window number of the first normal window
|
" find the window number of the first normal window
|
||||||
function! s:Opener._firstUsableWindow()
|
function! s:Opener._firstUsableWindow()
|
||||||
@ -217,18 +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
|
||||||
|
|
||||||
"resize the nerd tree back to the original size
|
let l:currentWindowNumber = winnr()
|
||||||
|
|
||||||
|
" 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
|
||||||
call nerdtree#exec('wincmd p')
|
|
||||||
|
call nerdtree#exec(l:currentWindowNumber . 'wincmd w')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" FUNCTION: Opener.open(target) {{{1
|
" FUNCTION: Opener.open(target) {{{1
|
||||||
|
Loading…
x
Reference in New Issue
Block a user