Skip to content
This repository has been archived by the owner on Sep 28, 2022. It is now read-only.

Do not update when a special buffer is selected #63

Merged
merged 1 commit into from
Sep 20, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion nerdtree_plugin/git_status.vim
Original file line number Diff line number Diff line change
Expand Up @@ -252,27 +252,37 @@ function! s:CursorHoldUpdate()
return
endif

" Do not update when a special buffer is selected
if !empty(&l:buftype)
return
endif

let l:winnr = winnr()
let l:altwinnr = winnr('#')

call g:NERDTree.CursorToTreeWin()
call b:NERDTree.root.refreshFlags()
call NERDTreeRender()

exec l:altwinnr . 'wincmd w'
exec l:winnr . 'wincmd w'
endfunction

augroup nerdtreegitplugin
autocmd BufWritePost * call s:FileUpdate(expand('%:p'))
augroup END

" FUNCTION: s:FileUpdate(fname) {{{2
function! s:FileUpdate(fname)
if g:NERDTreeUpdateOnWrite != 1
return
endif

if !g:NERDTree.IsOpen()
return
endif

let l:winnr = winnr()
let l:altwinnr = winnr('#')

call g:NERDTree.CursorToTreeWin()
let l:node = b:NERDTree.root.findNode(g:NERDTreePath.New(a:fname))
Expand All @@ -287,6 +297,8 @@ function! s:FileUpdate(fname)
endwhile

call NERDTreeRender()

exec l:altwinnr . 'wincmd w'
exec l:winnr . 'wincmd w'
endfunction

Expand Down