mirror of
https://github.com/junegunn/vim-plug.git
synced 2025-12-23 00:51:25 +08:00
Compare commits
8 Commits
35b92b509b
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3f17a5cc3d | ||
|
|
904dac1530 | ||
|
|
baa66bcf34 | ||
|
|
cdea0244a5 | ||
|
|
9ef7739c81 | ||
|
|
7cadca537e | ||
|
|
a7d4a73dd6 | ||
|
|
d80f495fab |
41
README.md
41
README.md
@@ -1,21 +1,26 @@
|
|||||||
<div align="center">
|
<div align="center" markdown="1">
|
||||||
<sup>Special thanks to:</sup>
|
<sup>Special thanks to:</sup>
|
||||||
<br>
|
<br>
|
||||||
<br>
|
<a href="https://tuple.app/vim-plug">
|
||||||
<a href="https://warp.dev/?utm_source=github&utm_medium=referral&utm_campaign=vimplug_20240209">
|
<img alt="Tuple's sponsorship image" src="https://raw.githubusercontent.com/junegunn/i/master/tuple.png" width="400">
|
||||||
<div>
|
</a>
|
||||||
<img src="https://raw.githubusercontent.com/junegunn/i/master/warp.png" width="300" alt="Warp">
|
|
||||||
</div>
|
|
||||||
<b>Warp is a modern, Rust-based terminal with AI built in so you and your team can build great software, faster.</b>
|
|
||||||
<div>
|
|
||||||
<sup>Visit warp.dev to learn more.</sup>
|
|
||||||
</div>
|
|
||||||
</a>
|
|
||||||
<br>
|
|
||||||
<hr>
|
|
||||||
</div>
|
|
||||||
<br>
|
|
||||||
|
|
||||||
|
### [Tuple, the premier screen sharing app for developers](https://tuple.app/vim-plug)
|
||||||
|
[Available for MacOS & Windows](https://tuple.app/vim-plug)<br>
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<sup>Special thanks to:</sup>
|
||||||
|
<br>
|
||||||
|
<a href="https://www.warp.dev/?utm_source=github&utm_medium=referral&utm_campaign=vim-plug">
|
||||||
|
<img alt="Warp sponsorship" width="400" src="https://github.com/user-attachments/assets/ab8dd143-b0fd-4904-bdc5-dd7ecac94eae">
|
||||||
|
</a>
|
||||||
|
|
||||||
|
### [Warp, the intelligent terminal for developers](https://www.warp.dev/?utm_source=github&utm_medium=referral&utm_campaign=vim-plug)
|
||||||
|
[Available for MacOS, Linux, & Windows](https://www.warp.dev/?utm_source=github&utm_medium=referral&utm_campaign=vim-plug)<br>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<hr>
|
||||||
<h1 title="vim-plug">
|
<h1 title="vim-plug">
|
||||||
<picture>
|
<picture>
|
||||||
<source media="(prefers-color-scheme: dark)" srcset="./plug-dark.png">
|
<source media="(prefers-color-scheme: dark)" srcset="./plug-dark.png">
|
||||||
@@ -315,7 +320,7 @@ vim.cmd('silent! colorscheme seoul256')
|
|||||||
- `S` - `PlugStatus`
|
- `S` - `PlugStatus`
|
||||||
- `R` - Retry failed update or installation tasks
|
- `R` - Retry failed update or installation tasks
|
||||||
- `U` - Update plugins in the selected range
|
- `U` - Update plugins in the selected range
|
||||||
- `q` - Close the window
|
- `q` - Abort the running tasks or close the window
|
||||||
- `:PlugStatus`
|
- `:PlugStatus`
|
||||||
- `L` - Load plugin
|
- `L` - Load plugin
|
||||||
- `:PlugDiff`
|
- `:PlugDiff`
|
||||||
|
|||||||
160
plug.vim
160
plug.vim
@@ -84,9 +84,6 @@ let s:TYPE = {
|
|||||||
\ }
|
\ }
|
||||||
let s:loaded = get(s:, 'loaded', {})
|
let s:loaded = get(s:, 'loaded', {})
|
||||||
let s:triggers = get(s:, 'triggers', {})
|
let s:triggers = get(s:, 'triggers', {})
|
||||||
let s:need_filetypeplugin_au = 0
|
|
||||||
let s:need_filetypeindent_au = 0
|
|
||||||
let s:autocmd_queue_for_vimenter = []
|
|
||||||
|
|
||||||
function! s:is_powershell(shell)
|
function! s:is_powershell(shell)
|
||||||
return a:shell =~# 'powershell\(\.exe\)\?$' || a:shell =~# 'pwsh\(\.exe\)\?$'
|
return a:shell =~# 'powershell\(\.exe\)\?$' || a:shell =~# 'pwsh\(\.exe\)\?$'
|
||||||
@@ -326,21 +323,6 @@ function! plug#end()
|
|||||||
if get(g:, 'did_load_filetypes', 0)
|
if get(g:, 'did_load_filetypes', 0)
|
||||||
filetype off
|
filetype off
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let warn = []
|
|
||||||
if exists('g:did_load_ftplugin')
|
|
||||||
let warn += ['plugin']
|
|
||||||
let s:need_filetypeindent_au = 1
|
|
||||||
endif
|
|
||||||
if exists('g:did_indent_on')
|
|
||||||
let warn += ['indent']
|
|
||||||
let s:need_filetypeplugin_au = 1
|
|
||||||
endif
|
|
||||||
if !empty(warn)
|
|
||||||
redraw
|
|
||||||
call s:warn('echom', printf('[vim-plug] "filetype %s on" should not be used manually with vim-plug, please remove it from your vimrc.', join(warn)))
|
|
||||||
endif
|
|
||||||
|
|
||||||
for name in g:plugs_order
|
for name in g:plugs_order
|
||||||
if !has_key(g:plugs, name)
|
if !has_key(g:plugs, name)
|
||||||
continue
|
continue
|
||||||
@@ -390,8 +372,10 @@ function! plug#end()
|
|||||||
|
|
||||||
for [cmd, names] in items(lod.cmd)
|
for [cmd, names] in items(lod.cmd)
|
||||||
execute printf(
|
execute printf(
|
||||||
\ 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "<bang>", <line1>, <line2>, <q-args>, %s)',
|
\ has('patch-7.4.1898')
|
||||||
\ cmd, string(cmd), string(names))
|
\ ? 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "<bang>", <line1>, <line2>, <q-args>, <q-mods> ,%s)'
|
||||||
|
\ : 'command! -nargs=* -range -bang -complete=file %s call s:lod_cmd(%s, "<bang>", <line1>, <line2>, <q-args>, %s)'
|
||||||
|
\ , cmd, string(cmd), string(names))
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
for [map, names] in items(lod.map)
|
for [map, names] in items(lod.map)
|
||||||
@@ -416,21 +400,7 @@ function! plug#end()
|
|||||||
if has('syntax') && !exists('g:syntax_on')
|
if has('syntax') && !exists('g:syntax_on')
|
||||||
syntax enable
|
syntax enable
|
||||||
end
|
end
|
||||||
|
|
||||||
" NOTE: v:vim_did_enter might not exist with older Vims, and handling it
|
|
||||||
" manually can be used in tests.
|
|
||||||
let s:vim_did_enter = 0
|
|
||||||
function! s:plug_on_vimenter()
|
|
||||||
let s:vim_did_enter = 1
|
|
||||||
for event in s:autocmd_queue_for_vimenter
|
|
||||||
call s:doautocmd(event)
|
|
||||||
endfor
|
|
||||||
endfunction
|
|
||||||
augroup PlugLOD
|
|
||||||
autocmd VimEnter * call s:plug_on_vimenter()
|
|
||||||
augroup END
|
|
||||||
else
|
else
|
||||||
let s:vim_did_enter = 1
|
|
||||||
call s:reload_plugins()
|
call s:reload_plugins()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@@ -593,12 +563,6 @@ function! s:reorg_rtp()
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:doautocmd(...)
|
function! s:doautocmd(...)
|
||||||
if !s:vim_did_enter
|
|
||||||
if index(s:autocmd_queue_for_vimenter, a:000) == -1
|
|
||||||
call add(s:autocmd_queue_for_vimenter, a:000)
|
|
||||||
endif
|
|
||||||
return
|
|
||||||
endif
|
|
||||||
if exists('#'.join(a:000, '#'))
|
if exists('#'.join(a:000, '#'))
|
||||||
execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '<nomodeline>' : '') join(a:000)
|
execute 'doautocmd' ((v:version > 703 || has('patch442')) ? '<nomodeline>' : '') join(a:000)
|
||||||
endif
|
endif
|
||||||
@@ -609,7 +573,9 @@ function! s:dobufread(names)
|
|||||||
let path = s:rtp(g:plugs[name])
|
let path = s:rtp(g:plugs[name])
|
||||||
for dir in ['ftdetect', 'ftplugin', 'after/ftdetect', 'after/ftplugin']
|
for dir in ['ftdetect', 'ftplugin', 'after/ftdetect', 'after/ftplugin']
|
||||||
if len(finddir(dir, path))
|
if len(finddir(dir, path))
|
||||||
call s:doautocmd('BufRead')
|
if exists('#BufRead')
|
||||||
|
doautocmd BufRead
|
||||||
|
endif
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
@@ -683,24 +649,23 @@ function! s:lod_ft(pat, names)
|
|||||||
let syn = 'syntax/'.a:pat.'.vim'
|
let syn = 'syntax/'.a:pat.'.vim'
|
||||||
call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn)
|
call s:lod(a:names, ['plugin', 'after/plugin'], syn, 'after/'.syn)
|
||||||
execute 'autocmd! PlugLOD FileType' a:pat
|
execute 'autocmd! PlugLOD FileType' a:pat
|
||||||
|
call s:doautocmd('filetypeplugin', 'FileType')
|
||||||
" Executing this is only necessary if "filetype plugin indent on" was used
|
call s:doautocmd('filetypeindent', 'FileType')
|
||||||
" before plug#end, and can be skipped when Vim has not entered always.
|
|
||||||
if s:vim_did_enter
|
|
||||||
if s:need_filetypeplugin_au
|
|
||||||
call s:doautocmd('filetypeplugin', 'FileType')
|
|
||||||
endif
|
|
||||||
if s:need_filetypeindent_au
|
|
||||||
call s:doautocmd('filetypeindent', 'FileType')
|
|
||||||
endif
|
|
||||||
endif
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:lod_cmd(cmd, bang, l1, l2, args, names)
|
if has('patch-7.4.1898')
|
||||||
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
function! s:lod_cmd(cmd, bang, l1, l2, args, mods, names)
|
||||||
call s:dobufread(a:names)
|
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||||
execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
|
call s:dobufread(a:names)
|
||||||
endfunction
|
execute printf('%s %s%s%s %s', a:mods, (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
|
||||||
|
endfunction
|
||||||
|
else
|
||||||
|
function! s:lod_cmd(cmd, bang, l1, l2, args, names)
|
||||||
|
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||||
|
call s:dobufread(a:names)
|
||||||
|
execute printf('%s%s%s %s', (a:l1 == a:l2 ? '' : (a:l1.','.a:l2)), a:cmd, a:bang, a:args)
|
||||||
|
endfunction
|
||||||
|
endif
|
||||||
|
|
||||||
function! s:lod_map(map, names, with_prefix, prefix)
|
function! s:lod_map(map, names, with_prefix, prefix)
|
||||||
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
call s:lod(a:names, ['ftdetect', 'after/ftdetect', 'plugin', 'after/plugin'])
|
||||||
@@ -828,10 +793,11 @@ endfunction
|
|||||||
function! s:syntax()
|
function! s:syntax()
|
||||||
syntax clear
|
syntax clear
|
||||||
syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber
|
syntax region plug1 start=/\%1l/ end=/\%2l/ contains=plugNumber
|
||||||
syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX
|
syntax region plug2 start=/\%2l/ end=/\%3l/ contains=plugBracket,plugX,plugAbort
|
||||||
syn match plugNumber /[0-9]\+[0-9.]*/ contained
|
syn match plugNumber /[0-9]\+[0-9.]*/ contained
|
||||||
syn match plugBracket /[[\]]/ contained
|
syn match plugBracket /[[\]]/ contained
|
||||||
syn match plugX /x/ contained
|
syn match plugX /x/ contained
|
||||||
|
syn match plugAbort /\~/ contained
|
||||||
syn match plugDash /^-\{1}\ /
|
syn match plugDash /^-\{1}\ /
|
||||||
syn match plugPlus /^+/
|
syn match plugPlus /^+/
|
||||||
syn match plugStar /^*/
|
syn match plugStar /^*/
|
||||||
@@ -856,6 +822,7 @@ function! s:syntax()
|
|||||||
hi def link plug2 Repeat
|
hi def link plug2 Repeat
|
||||||
hi def link plugH2 Type
|
hi def link plugH2 Type
|
||||||
hi def link plugX Exception
|
hi def link plugX Exception
|
||||||
|
hi def link plugAbort Ignore
|
||||||
hi def link plugBracket Structure
|
hi def link plugBracket Structure
|
||||||
hi def link plugNumber Number
|
hi def link plugNumber Number
|
||||||
|
|
||||||
@@ -953,7 +920,7 @@ function! s:prepare(...)
|
|||||||
endif
|
endif
|
||||||
endfor
|
endfor
|
||||||
|
|
||||||
call s:job_abort()
|
call s:job_abort(0)
|
||||||
if s:switch_in()
|
if s:switch_in()
|
||||||
if b:plug_preview == 1
|
if b:plug_preview == 1
|
||||||
pc
|
pc
|
||||||
@@ -989,6 +956,8 @@ function! s:close_pane()
|
|||||||
if b:plug_preview == 1
|
if b:plug_preview == 1
|
||||||
pc
|
pc
|
||||||
let b:plug_preview = -1
|
let b:plug_preview = -1
|
||||||
|
elseif exists('s:jobs') && !empty(s:jobs)
|
||||||
|
call s:job_abort(1)
|
||||||
else
|
else
|
||||||
bd
|
bd
|
||||||
endif
|
endif
|
||||||
@@ -1116,12 +1085,16 @@ function! s:hash_match(a, b)
|
|||||||
return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0
|
return stridx(a:a, a:b) == 0 || stridx(a:b, a:a) == 0
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:disable_credential_helper()
|
||||||
|
return s:git_version_requirement(2) && get(g:, 'plug_disable_credential_helper', 1)
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:checkout(spec)
|
function! s:checkout(spec)
|
||||||
let sha = a:spec.commit
|
let sha = a:spec.commit
|
||||||
let output = s:git_revision(a:spec.dir)
|
let output = s:git_revision(a:spec.dir)
|
||||||
let error = 0
|
let error = 0
|
||||||
if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
|
if !empty(output) && !s:hash_match(sha, s:lines(output)[0])
|
||||||
let credential_helper = s:git_version_requirement(2) ? '-c credential.helper= ' : ''
|
let credential_helper = s:disable_credential_helper() ? '-c credential.helper= ' : ''
|
||||||
let output = s:system(
|
let output = s:system(
|
||||||
\ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
|
\ 'git '.credential_helper.'fetch --depth 999999 && git checkout '.plug#shellescape(sha).' --', a:spec.dir)
|
||||||
let error = v:shell_error
|
let error = v:shell_error
|
||||||
@@ -1371,7 +1344,12 @@ function! s:update_finish()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:job_abort()
|
function! s:mark_aborted(name, message)
|
||||||
|
let attrs = { 'running': 0, 'error': 1, 'abort': 1, 'lines': [a:message] }
|
||||||
|
let s:jobs[a:name] = extend(get(s:jobs, a:name, {}), attrs)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
function! s:job_abort(cancel)
|
||||||
if (!s:nvim && !s:vim8) || !exists('s:jobs')
|
if (!s:nvim && !s:vim8) || !exists('s:jobs')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
@@ -1385,8 +1363,18 @@ function! s:job_abort()
|
|||||||
if j.new
|
if j.new
|
||||||
call s:rm_rf(g:plugs[name].dir)
|
call s:rm_rf(g:plugs[name].dir)
|
||||||
endif
|
endif
|
||||||
|
if a:cancel
|
||||||
|
call s:mark_aborted(name, 'Aborted')
|
||||||
|
endif
|
||||||
endfor
|
endfor
|
||||||
let s:jobs = {}
|
|
||||||
|
if a:cancel
|
||||||
|
for todo in values(s:update.todo)
|
||||||
|
let todo.abort = 1
|
||||||
|
endfor
|
||||||
|
else
|
||||||
|
let s:jobs = {}
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:last_non_empty_line(lines)
|
function! s:last_non_empty_line(lines)
|
||||||
@@ -1400,6 +1388,16 @@ function! s:last_non_empty_line(lines)
|
|||||||
return ''
|
return ''
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
function! s:bullet_for(job, ...)
|
||||||
|
if a:job.running
|
||||||
|
return a:job.new ? '+' : '*'
|
||||||
|
endif
|
||||||
|
if get(a:job, 'abort', 0)
|
||||||
|
return '~'
|
||||||
|
endif
|
||||||
|
return a:job.error ? 'x' : get(a:000, 0, '-')
|
||||||
|
endfunction
|
||||||
|
|
||||||
function! s:job_out_cb(self, data) abort
|
function! s:job_out_cb(self, data) abort
|
||||||
let self = a:self
|
let self = a:self
|
||||||
let data = remove(self.lines, -1) . a:data
|
let data = remove(self.lines, -1) . a:data
|
||||||
@@ -1408,10 +1406,9 @@ function! s:job_out_cb(self, data) abort
|
|||||||
" To reduce the number of buffer updates
|
" To reduce the number of buffer updates
|
||||||
let self.tick = get(self, 'tick', -1) + 1
|
let self.tick = get(self, 'tick', -1) + 1
|
||||||
if !self.running || self.tick % len(s:jobs) == 0
|
if !self.running || self.tick % len(s:jobs) == 0
|
||||||
let bullet = self.running ? (self.new ? '+' : '*') : (self.error ? 'x' : '-')
|
|
||||||
let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines)
|
let result = self.error ? join(self.lines, "\n") : s:last_non_empty_line(self.lines)
|
||||||
if len(result)
|
if len(result)
|
||||||
call s:log(bullet, self.name, result)
|
call s:log(s:bullet_for(self), self.name, result)
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@@ -1425,7 +1422,7 @@ endfunction
|
|||||||
|
|
||||||
function! s:job_cb(fn, job, ch, data)
|
function! s:job_cb(fn, job, ch, data)
|
||||||
if !s:plug_window_exists() " plug window closed
|
if !s:plug_window_exists() " plug window closed
|
||||||
return s:job_abort()
|
return s:job_abort(0)
|
||||||
endif
|
endif
|
||||||
call call(a:fn, [a:job, a:data])
|
call call(a:fn, [a:job, a:data])
|
||||||
endfunction
|
endfunction
|
||||||
@@ -1497,17 +1494,16 @@ function! s:reap(name)
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
let more = len(get(job, 'queue', []))
|
let more = len(get(job, 'queue', []))
|
||||||
let bullet = job.error ? 'x' : more ? (job.new ? '+' : '*') : '-'
|
|
||||||
let result = job.error ? join(job.lines, "\n") : s:last_non_empty_line(job.lines)
|
let result = job.error ? join(job.lines, "\n") : s:last_non_empty_line(job.lines)
|
||||||
if len(result)
|
if len(result)
|
||||||
call s:log(bullet, a:name, result)
|
call s:log(s:bullet_for(job), a:name, result)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if !job.error && more
|
if !job.error && more
|
||||||
let job.spec.queue = job.queue
|
let job.spec.queue = job.queue
|
||||||
let s:update.todo[a:name] = job.spec
|
let s:update.todo[a:name] = job.spec
|
||||||
else
|
else
|
||||||
let s:update.bar .= job.error ? 'x' : '='
|
let s:update.bar .= s:bullet_for(job, '=')
|
||||||
call s:bar()
|
call s:bar()
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
@@ -1586,6 +1582,12 @@ while 1 " Without TCO, Vim stack is bound to explode
|
|||||||
|
|
||||||
let name = keys(s:update.todo)[0]
|
let name = keys(s:update.todo)[0]
|
||||||
let spec = remove(s:update.todo, name)
|
let spec = remove(s:update.todo, name)
|
||||||
|
if get(spec, 'abort', 0)
|
||||||
|
call s:mark_aborted(name, 'Skipped')
|
||||||
|
call s:reap(name)
|
||||||
|
continue
|
||||||
|
endif
|
||||||
|
|
||||||
let queue = get(spec, 'queue', [])
|
let queue = get(spec, 'queue', [])
|
||||||
let new = empty(globpath(spec.dir, '.git', 1))
|
let new = empty(globpath(spec.dir, '.git', 1))
|
||||||
|
|
||||||
@@ -1601,7 +1603,7 @@ while 1 " Without TCO, Vim stack is bound to explode
|
|||||||
let [error, _] = s:git_validate(spec, 0)
|
let [error, _] = s:git_validate(spec, 0)
|
||||||
if empty(error)
|
if empty(error)
|
||||||
if pull
|
if pull
|
||||||
let cmd = s:git_version_requirement(2) ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
|
let cmd = s:disable_credential_helper() ? ['git', '-c', 'credential.helper=', 'fetch'] : ['git', 'fetch']
|
||||||
if has_tag && !empty(globpath(spec.dir, '.git/shallow'))
|
if has_tag && !empty(globpath(spec.dir, '.git/shallow'))
|
||||||
call extend(cmd, ['--depth', '99999999'])
|
call extend(cmd, ['--depth', '99999999'])
|
||||||
endif
|
endif
|
||||||
@@ -2381,7 +2383,9 @@ function! s:git_validate(spec, check_branch)
|
|||||||
let err = join(['Invalid URI: '.remote,
|
let err = join(['Invalid URI: '.remote,
|
||||||
\ 'Expected: '.a:spec.uri,
|
\ 'Expected: '.a:spec.uri,
|
||||||
\ 'PlugClean required.'], "\n")
|
\ 'PlugClean required.'], "\n")
|
||||||
elseif a:check_branch && has_key(a:spec, 'commit')
|
elseif !a:check_branch
|
||||||
|
return ['', 0]
|
||||||
|
elseif has_key(a:spec, 'commit')
|
||||||
let sha = s:git_revision(a:spec.dir)
|
let sha = s:git_revision(a:spec.dir)
|
||||||
if empty(sha)
|
if empty(sha)
|
||||||
let err = join(add(result, 'PlugClean required.'), "\n")
|
let err = join(add(result, 'PlugClean required.'), "\n")
|
||||||
@@ -2390,18 +2394,16 @@ function! s:git_validate(spec, check_branch)
|
|||||||
\ a:spec.commit[:6], sha[:6]),
|
\ a:spec.commit[:6], sha[:6]),
|
||||||
\ 'PlugUpdate required.'], "\n")
|
\ 'PlugUpdate required.'], "\n")
|
||||||
endif
|
endif
|
||||||
|
elseif has_key(a:spec, 'tag')
|
||||||
|
let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir)
|
||||||
|
if a:spec.tag !=# tag && a:spec.tag !~ '\*'
|
||||||
|
let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.',
|
||||||
|
\ (empty(tag) ? 'N/A' : tag), a:spec.tag)
|
||||||
|
endif
|
||||||
elseif a:check_branch
|
elseif a:check_branch
|
||||||
let current_branch = result[0]
|
let current_branch = result[0]
|
||||||
" Check tag
|
|
||||||
let origin_branch = s:git_origin_branch(a:spec)
|
let origin_branch = s:git_origin_branch(a:spec)
|
||||||
if has_key(a:spec, 'tag')
|
if origin_branch !=# current_branch
|
||||||
let tag = s:system_chomp('git describe --exact-match --tags HEAD 2>&1', a:spec.dir)
|
|
||||||
if a:spec.tag !=# tag && a:spec.tag !~ '\*'
|
|
||||||
let err = printf('Invalid tag: %s (expected: %s). Try PlugUpdate.',
|
|
||||||
\ (empty(tag) ? 'N/A' : tag), a:spec.tag)
|
|
||||||
endif
|
|
||||||
" Check branch
|
|
||||||
elseif origin_branch !=# current_branch
|
|
||||||
let err = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.',
|
let err = printf('Invalid branch: %s (expected: %s). Try PlugUpdate.',
|
||||||
\ current_branch, origin_branch)
|
\ current_branch, origin_branch)
|
||||||
endif
|
endif
|
||||||
|
|||||||
@@ -5,10 +5,6 @@ Execute (#112 On-demand loading should not suppress messages from ftplugin):
|
|||||||
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': 'c' }
|
Plug '$PLUG_FIXTURES/ftplugin-msg', { 'for': 'c' }
|
||||||
call plug#end()
|
call plug#end()
|
||||||
|
|
||||||
" Trigger VimEnter (simulate Vim being started), so that s:lod handles
|
|
||||||
" filetypeindent/filetypeplugin."
|
|
||||||
doautocmd VimEnter
|
|
||||||
|
|
||||||
redir => out
|
redir => out
|
||||||
tabnew a.c
|
tabnew a.c
|
||||||
redir END
|
redir END
|
||||||
|
|||||||
@@ -1230,7 +1230,7 @@ Execute (Filetype-based on-demand loading):
|
|||||||
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
|
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect'], g:xxx
|
||||||
|
|
||||||
setf xxx
|
setf xxx
|
||||||
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/syntax', 'xxx/after/syntax'], g:xxx
|
AssertEqual ['xxx/ftdetect', 'xxx/after/ftdetect', 'xxx/plugin', 'xxx/after/plugin', 'xxx/syntax', 'xxx/after/syntax', 'xxx/ftplugin', 'xxx/after/ftplugin', 'xxx/indent', 'xxx/after/indent'], g:xxx
|
||||||
|
|
||||||
" syntax/xxx.vim and after/syntax/xxx.vim should not be loaded (#410)
|
" syntax/xxx.vim and after/syntax/xxx.vim should not be loaded (#410)
|
||||||
setf yyy
|
setf yyy
|
||||||
|
|||||||
Reference in New Issue
Block a user