extract signing into function
This commit is contained in:
parent
d09841e4a6
commit
a038016df3
@ -27,10 +27,12 @@ com! -nargs=? -bang BundleSearch
|
||||
au Filetype vundle call vundle#scripts#setup_view()
|
||||
au Syntax vim syn keyword vimCommand Bundle
|
||||
|
||||
if (has('signs'))
|
||||
sign define VuEr text=! texthl=Error
|
||||
sign define VuAc text=> texthl=Comment
|
||||
sign define VuCu text=. texthl=Comment
|
||||
sign define VuUp text=+ texthl=Comment
|
||||
endif
|
||||
|
||||
|
||||
func! vundle#rc(...) abort
|
||||
|
@ -41,29 +41,37 @@ func! s:display(headers, results)
|
||||
call vundle#scripts#setup_view()
|
||||
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
|
||||
if !isdirectory(g:bundle_dir) | call mkdir(g:bundle_dir, 'p') | endif
|
||||
|
||||
let b = vundle#config#init_bundle(a:name, {})
|
||||
|
||||
echo 'Installing '.b.name
|
||||
exe ":sign place ".line('.')." line=".line('.')." name=VuAc buffer=" . bufnr("$")
|
||||
|
||||
call s:sign('active')
|
||||
sleep 1m
|
||||
|
||||
let status = s:sync(a:bang, b)
|
||||
|
||||
call s:sign(status)
|
||||
|
||||
if 'updated' == status
|
||||
echo b.name.' installed'
|
||||
exe ":sign place ".line('.')." line=".line('.')." name=VuUp buffer=" . bufnr("$")
|
||||
elseif 'uptodate' == status
|
||||
echo b.name.' already installed'
|
||||
exe ":sign place ".line('.')." line=".line('.')." name=VuCu buffer=" . bufnr("$")
|
||||
elseif 'error' == status
|
||||
echohl Error
|
||||
echo 'Error installing "'.b.name
|
||||
echohl None
|
||||
exe ":sign place ".line('.')." line=".line('.')." name=VuEr buffer=" . bufnr("$")
|
||||
sleep 1
|
||||
else
|
||||
throw 'whoops, unknown status:'.status
|
||||
|
Loading…
Reference in New Issue
Block a user