commit 80ee0897ff4d4f0583c0c4985d352162d8166d6e
parent 35953042fbf5535a7e905b52a6973c3f7f8a5536
Author: Jason Franklin <j_fra@fastmail.us>
Date: Sat, 26 May 2018 08:43:27 -0400
Add a call to ":clearjumps" to "_createTreeWin()"
Using the ":clearjumps" command wipes out the jump list for the
current window. This means that the user can't inadvertently jump
out of the NERDTree buffer while using the NERDTree window (i.e., by
using "<C-O>").
Diffstat:
1 file changed, 14 insertions(+), 10 deletions(-)
diff --git a/lib/nerdtree/creator.vim b/lib/nerdtree/creator.vim
@@ -178,24 +178,28 @@ function! s:Creator.createMirror()
endfunction
" FUNCTION: s:Creator._createTreeWin() {{{1
-" Inits the NERD tree window. ie. opens it, sizes it, sets all the local
-" options etc
+" Initialize the NERDTree window. Open the window, size it properly, set all
+" local options, etc.
function! s:Creator._createTreeWin()
- "create the nerd tree window
- let splitLocation = g:NERDTreeWinPos ==# "left" ? "topleft " : "botright "
- let splitSize = g:NERDTreeWinSize
+ let l:splitLocation = g:NERDTreeWinPos ==# 'left' ? 'topleft ' : 'botright '
+ let l:splitSize = g:NERDTreeWinSize
if !g:NERDTree.ExistsForTab()
let t:NERDTreeBufName = self._nextBufferName()
- silent! exec splitLocation . 'vertical ' . splitSize . ' new'
- silent! exec "edit " . t:NERDTreeBufName
+ silent! execute l:splitLocation . 'vertical ' . l:splitSize . ' new'
+ silent! execute 'edit ' . t:NERDTreeBufName
else
- silent! exec splitLocation . 'vertical ' . splitSize . ' split'
- silent! exec "buffer " . t:NERDTreeBufName
+ 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