- Sourcing self after upgrage
- Error highlighting
- https://git:@ prefix to avoid username/password prompt
This commit is contained in:
Junegunn Choi 2013-09-11 02:26:40 +09:00
parent b84c7094fd
commit bc438626ba

View File

@ -77,7 +77,7 @@ function! plug#init(...)
command! -nargs=* PlugInstall call s:install(<f-args>) command! -nargs=* PlugInstall call s:install(<f-args>)
command! -nargs=* PlugUpdate call s:update(<f-args>) command! -nargs=* PlugUpdate call s:update(<f-args>)
command! -nargs=0 PlugClean call s:clean() command! -nargs=0 PlugClean call s:clean()
command! -nargs=0 PlugUpgrade call s:upgrade() command! -nargs=0 PlugUpgrade if s:upgrade() | execute "source ". s:me | endif
endfunction endfunction
function! s:add(...) function! s:add(...)
@ -96,7 +96,7 @@ function! s:add(...)
let name = split(plugin, '/')[-1] let name = split(plugin, '/')[-1]
let dir = fnamemodify(join([g:plug_home, plugin, branch], '/'), ':p') let dir = fnamemodify(join([g:plug_home, plugin, branch], '/'), ':p')
let uri = 'https://github.com/' . plugin let uri = 'https://git:@github.com/' . plugin . '.git'
let spec = { 'name': name, 'dir': dir, 'uri': uri, 'branch': branch } let spec = { 'name': name, 'dir': dir, 'uri': uri, 'branch': branch }
execute "set rtp+=".dir execute "set rtp+=".dir
let g:plug[plugin] = spec let g:plug[plugin] = spec
@ -130,12 +130,14 @@ function! s:syntax()
syn match plugBracket /[[\]]/ containedin=plug2 syn match plugBracket /[[\]]/ containedin=plug2
syn match plugDash /^-/ syn match plugDash /^-/
syn match plugName /\(^- \)\@<=[^:]*/ syn match plugName /\(^- \)\@<=[^:]*/
syn match plugError /^- [^:]\+: (x).*/
hi def link plug1 Title hi def link plug1 Title
hi def link plug2 Repeat hi def link plug2 Repeat
hi def link plugBracket Structure hi def link plugBracket Structure
hi def link plugNumber Number hi def link plugNumber Number
hi def link plugDash Special hi def link plugDash Special
hi def link plugName Label hi def link plugName Label
hi def link plugError Error
endfunction endfunction
function! s:lpad(str, len) function! s:lpad(str, len)
@ -347,14 +349,15 @@ function! s:upgrade()
\ new, s:plug_source, mee, mee, new, mee)) \ new, s:plug_source, mee, mee, new, mee))
if v:shell_error == 0 if v:shell_error == 0
unlet g:loaded_plug unlet g:loaded_plug
echo "Now reload vim-plug with: source ". s:me echo "Downloaded ". s:plug_source
return 1
else else
echoerr "Error upgrading vim-plug" echoerr "Error upgrading vim-plug"
return return 0
endif endif
else else
echoerr "`curl' not found" echoerr "`curl' not found"
return return 0
endif endif
endfunction endfunction