Skip to content
Closed
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
16 changes: 16 additions & 0 deletions unbundle.vim
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,27 @@ function! Unftbundle(type)
execute 'source' fnameescape(l:plugin)
endfor

" reload autocmd FileType when filetype already loaded
if s:filetype_loaded == 1
let &l:filetype = &l:filetype
endif

" apply newly loaded ftbundles to currently open buffers
doautoall BufRead
endif
endfunction

" If `filetype plugin indent on` already set before unbundle.vim load
" unbundle.vim need to reload filetype
redir => filetype_out
silent! filetype
redir END

let s:filetype_loaded = 0
if filetype_out =~# 'plugin:ON\|plugin:(on)'
let s:filetype_loaded = 1
endif

" commands for manual invocation
command! Unbundle call Unbundle('bundle/*')
command! -nargs=1 -complete=filetype Unftbundle call Unftbundle(<f-args>)
Expand Down