Skip to content

Commit

Permalink
Fixes newly added files not having icons until refreshing nerdtree (f…
Browse files Browse the repository at this point in the history
…ixes #33)

* working solution for now using CursorHold to trigger nerdtree refresh (very similar to how nerdtree-git-plugin handles it)
  • Loading branch information
ryanoasis committed Aug 28, 2015
1 parent 044e035 commit 710f3b2
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions plugin/webdevicons.vim
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,30 @@ function! s:setSyntax()
endif
endfunction

" scope: local
" stole solution/idea from nerdtree-git-plugin :)
function! s:setCursorHold()
if g:webdevicons_enable_nerdtree
augroup webdevicons_cursor_hold
autocmd CursorHold * silent! call s:CursorHoldUpdate()
augroup END
endif
endfunction

" scope: local
" stole solution/idea from nerdtree-git-plugin :)
function! s:CursorHoldUpdate()
if g:NERDTreeUpdateOnCursorHold != 1
return
endif

if !g:NERDTree.IsOpen()
return
endif

b:NERDTreeRoot.refreshFlags()
endfunction

" scope: local
function! s:hardRefreshNerdTree()
if g:webdevicons_enable_nerdtree == 1 && g:webdevicons_conceal_nerdtree_brackets == 1 && g:NERDTree.IsOpen()
Expand Down Expand Up @@ -492,6 +516,7 @@ endfunction
function! s:initialize()
call s:setDictionaries()
call s:setSyntax()
call s:setCursorHold()
call s:initializeFlagship()
call s:initializeUnite()
call s:initializeVimfiler()
Expand Down

0 comments on commit 710f3b2

Please sign in to comment.