extract signing into function

This commit is contained in:
gmarik 2011-08-05 10:12:04 -05:00
parent d09841e4a6
commit a038016df3
2 changed files with 15 additions and 5 deletions

View File

@ -27,10 +27,12 @@ com! -nargs=? -bang BundleSearch
au Filetype vundle call vundle#scripts#setup_view() au Filetype vundle call vundle#scripts#setup_view()
au Syntax vim syn keyword vimCommand Bundle au Syntax vim syn keyword vimCommand Bundle
if (has('signs'))
sign define VuEr text=! texthl=Error sign define VuEr text=! texthl=Error
sign define VuAc text=> texthl=Comment sign define VuAc text=> texthl=Comment
sign define VuCu text=. texthl=Comment sign define VuCu text=. texthl=Comment
sign define VuUp text=+ texthl=Comment sign define VuUp text=+ texthl=Comment
endif
func! vundle#rc(...) abort func! vundle#rc(...) abort

View File

@ -41,29 +41,37 @@ func! s:display(headers, results)
call vundle#scripts#setup_view() call vundle#scripts#setup_view()
endf endf
func! s:sign(status)
if (!has('signs'))
return
endif
let markers = {'updated': 'VuUp', 'uptodate': 'VuCu', 'error': 'VuEr', 'active': 'VuAc' }
let marker = markers[a:status]
exe ":sign place ".line('.')." line=".line('.')." name=". marker ." buffer=" . bufnr("%")
endf
func! vundle#installer#install(bang, name) abort func! vundle#installer#install(bang, name) abort
if !isdirectory(g:bundle_dir) | call mkdir(g:bundle_dir, 'p') | endif if !isdirectory(g:bundle_dir) | call mkdir(g:bundle_dir, 'p') | endif
let b = vundle#config#init_bundle(a:name, {}) let b = vundle#config#init_bundle(a:name, {})
echo 'Installing '.b.name echo 'Installing '.b.name
exe ":sign place ".line('.')." line=".line('.')." name=VuAc buffer=" . bufnr("$") call s:sign('active')
sleep 1m sleep 1m
let status = s:sync(a:bang, b) let status = s:sync(a:bang, b)
call s:sign(status)
if 'updated' == status if 'updated' == status
echo b.name.' installed' echo b.name.' installed'
exe ":sign place ".line('.')." line=".line('.')." name=VuUp buffer=" . bufnr("$")
elseif 'uptodate' == status elseif 'uptodate' == status
echo b.name.' already installed' echo b.name.' already installed'
exe ":sign place ".line('.')." line=".line('.')." name=VuCu buffer=" . bufnr("$")
elseif 'error' == status elseif 'error' == status
echohl Error echohl Error
echo 'Error installing "'.b.name echo 'Error installing "'.b.name
echohl None echohl None
exe ":sign place ".line('.')." line=".line('.')." name=VuEr buffer=" . bufnr("$")
sleep 1 sleep 1
else else
throw 'whoops, unknown status:'.status throw 'whoops, unknown status:'.status