Mercurial > dotfiles.old
comparison vim/autoload/plug.vim @ 242:0994a5f99432
Update vimplug
author | zegervdv <zegervdv@me.com> |
---|---|
date | Tue, 17 Feb 2015 20:35:15 +0100 |
parents | 1d4692adfc1c |
children | 5199030e3e2c |
comparison
equal
deleted
inserted
replaced
241:5fb4bf06d46d | 242:0994a5f99432 |
---|---|
71 let s:plug_src = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' | 71 let s:plug_src = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim' |
72 let s:plug_tab = get(s:, 'plug_tab', -1) | 72 let s:plug_tab = get(s:, 'plug_tab', -1) |
73 let s:plug_buf = get(s:, 'plug_buf', -1) | 73 let s:plug_buf = get(s:, 'plug_buf', -1) |
74 let s:mac_gui = has('gui_macvim') && has('gui_running') | 74 let s:mac_gui = has('gui_macvim') && has('gui_running') |
75 let s:is_win = has('win32') || has('win64') | 75 let s:is_win = has('win32') || has('win64') |
76 let s:ruby = has('ruby') && has('patch-7.2.374') | 76 let s:ruby = has('ruby') && (v:version >= 703 || v:version == 702 && has('patch374')) |
77 let s:nvim = has('nvim') && !s:is_win | 77 let s:nvim = has('nvim') && !s:is_win |
78 let s:me = resolve(expand('<sfile>:p')) | 78 let s:me = resolve(expand('<sfile>:p')) |
79 let s:base_spec = { 'branch': 'master', 'frozen': 0 } | 79 let s:base_spec = { 'branch': 'master', 'frozen': 0 } |
80 let s:TYPE = { | 80 let s:TYPE = { |
81 \ 'string': type(''), | 81 \ 'string': type(''), |
113 return s:err('`git` executable not found. vim-plug requires git.') | 113 return s:err('`git` executable not found. vim-plug requires git.') |
114 endif | 114 endif |
115 command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install('<bang>' == '!', [<f-args>]) | 115 command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install('<bang>' == '!', [<f-args>]) |
116 command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update('<bang>' == '!', [<f-args>]) | 116 command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update('<bang>' == '!', [<f-args>]) |
117 command! -nargs=0 -bar -bang PlugClean call s:clean('<bang>' == '!') | 117 command! -nargs=0 -bar -bang PlugClean call s:clean('<bang>' == '!') |
118 command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:me | endif | 118 command! -nargs=0 -bar PlugUpgrade if s:upgrade() | execute 'source' s:esc(s:me) | endif |
119 command! -nargs=0 -bar PlugStatus call s:status() | 119 command! -nargs=0 -bar PlugStatus call s:status() |
120 command! -nargs=0 -bar PlugDiff call s:diff() | 120 command! -nargs=0 -bar PlugDiff call s:diff() |
121 command! -nargs=? -bar PlugSnapshot call s:snapshot(<f-args>) | 121 command! -nargs=? -bar PlugSnapshot call s:snapshot(<f-args>) |
122 endfunction | 122 endfunction |
123 | 123 |
130 endfunction | 130 endfunction |
131 | 131 |
132 function! s:source(from, ...) | 132 function! s:source(from, ...) |
133 for pattern in a:000 | 133 for pattern in a:000 |
134 for vim in s:lines(globpath(a:from, pattern)) | 134 for vim in s:lines(globpath(a:from, pattern)) |
135 execute 'source' vim | 135 execute 'source' s:esc(vim) |
136 endfor | 136 endfor |
137 endfor | 137 endfor |
138 endfunction | 138 endfunction |
139 | 139 |
140 function! s:assoc(dict, key, val) | 140 function! s:assoc(dict, key, val) |
325 endif | 325 endif |
326 | 326 |
327 let s:middle = get(s:, 'middle', &rtp) | 327 let s:middle = get(s:, 'middle', &rtp) |
328 let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])') | 328 let rtps = map(s:loaded_names(), 's:rtp(g:plugs[v:val])') |
329 let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), 'isdirectory(v:val)') | 329 let afters = filter(map(copy(rtps), 'globpath(v:val, "after")'), 'isdirectory(v:val)') |
330 let rtp = join(map(rtps, 's:escrtp(v:val)'), ',') | 330 let rtp = join(map(rtps, 'escape(v:val, ",")'), ',') |
331 \ . ','.s:middle.',' | 331 \ . ','.s:middle.',' |
332 \ . join(map(afters, 's:escrtp(v:val)'), ',') | 332 \ . join(map(afters, 'escape(v:val, ",")'), ',') |
333 let &rtp = substitute(substitute(rtp, ',,*', ',', 'g'), '^,\|,$', '', 'g') | 333 let &rtp = substitute(substitute(rtp, ',,*', ',', 'g'), '^,\|,$', '', 'g') |
334 let s:prtp = &rtp | 334 let s:prtp = &rtp |
335 | 335 |
336 if !empty(s:first_rtp) | 336 if !empty(s:first_rtp) |
337 execute 'set rtp^='.s:first_rtp | 337 execute 'set rtp^='.s:first_rtp |
716 echo 'No plugin to '. (a:pull ? 'update' : 'install') . '.' | 716 echo 'No plugin to '. (a:pull ? 'update' : 'install') . '.' |
717 echohl None | 717 echohl None |
718 return | 718 return |
719 endif | 719 endif |
720 | 720 |
721 if !s:is_win && s:git_version_requirement(2, 3) | |
722 let s:git_terminal_prompt = exists('$GIT_TERMINAL_PROMPT') ? $GIT_TERMINAL_PROMPT : '' | |
723 let $GIT_TERMINAL_PROMPT = 0 | |
724 for plug in values(todo) | |
725 let plug.uri = substitute(plug.uri, | |
726 \ '^https://git::@github\.com', 'https://github.com', '') | |
727 endfor | |
728 endif | |
729 | |
721 if !isdirectory(g:plug_home) | 730 if !isdirectory(g:plug_home) |
722 try | 731 try |
723 call mkdir(g:plug_home, 'p') | 732 call mkdir(g:plug_home, 'p') |
724 catch | 733 catch |
725 return s:err(printf('Invalid plug directory: %s. '. | 734 return s:err(printf('Invalid plug directory: %s. '. |
775 call s:update_vim() | 784 call s:update_vim() |
776 endif | 785 endif |
777 endfunction | 786 endfunction |
778 | 787 |
779 function! s:update_finish() | 788 function! s:update_finish() |
789 if exists('s:git_terminal_prompt') | |
790 let $GIT_TERMINAL_PROMPT = s:git_terminal_prompt | |
791 endif | |
780 if s:switch_in() | 792 if s:switch_in() |
781 call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'has_key(v:val, "do")')) | 793 call s:do(s:update.pull, s:update.force, filter(copy(s:update.all), 'has_key(v:val, "do")')) |
782 call s:finish(s:update.pull) | 794 call s:finish(s:update.pull) |
783 call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.') | 795 call setline(1, 'Updated. Elapsed time: ' . split(reltimestr(reltime(s:update.start)))[0] . ' sec.') |
784 call s:switch_out('normal! gg') | 796 call s:switch_out('normal! gg') |
1560 redraw | 1572 redraw |
1561 endif | 1573 endif |
1562 endfor | 1574 endfor |
1563 | 1575 |
1564 if a:0 > 0 | 1576 if a:0 > 0 |
1565 let fn = s:esc(expand(a:1)) | 1577 let fn = expand(a:1) |
1578 let fne = s:esc(fn) | |
1566 call writefile(getline(1, '$'), fn) | 1579 call writefile(getline(1, '$'), fn) |
1567 if !s:is_win | call s:system('chmod +x ' . fn) | endif | 1580 if !s:is_win | call s:system('chmod +x ' . fne) | endif |
1568 echo 'Saved to '.a:1 | 1581 echo 'Saved to '.a:1 |
1569 silent execute 'e' fn | 1582 silent execute 'e' fne |
1570 endif | 1583 endif |
1571 endfunction | 1584 endfunction |
1572 | 1585 |
1573 function! s:split_rtp() | 1586 function! s:split_rtp() |
1574 return split(&rtp, '\\\@<!,') | 1587 return split(&rtp, '\\\@<!,') |