|
|
@ -116,6 +116,10 @@ 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', {})
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function! s:is_powershell(shell)
|
|
|
|
|
|
|
|
return a:shell =~# 'powershell\(\.exe\)\?$' || a:shell =~# 'pwsh\(\.exe\)\?$'
|
|
|
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
function! s:isabsolute(dir) abort
|
|
|
|
function! s:isabsolute(dir) abort
|
|
|
|
return a:dir =~# '^/' || (has('win32') && a:dir =~? '^\%(\\\|[A-Z]:\)')
|
|
|
|
return a:dir =~# '^/' || (has('win32') && a:dir =~? '^\%(\\\|[A-Z]:\)')
|
|
|
|
endfunction
|
|
|
|
endfunction
|
|
|
@ -263,7 +267,7 @@ function! s:define_commands()
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
if has('win32')
|
|
|
|
if has('win32')
|
|
|
|
\ && &shellslash
|
|
|
|
\ && &shellslash
|
|
|
|
\ && (&shell =~# 'cmd\(\.exe\)\?$' || &shell =~# 'powershell\(\.exe\)\?$')
|
|
|
|
\ && (&shell =~# 'cmd\(\.exe\)\?$' || s:is_powershell(&shell))
|
|
|
|
return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.')
|
|
|
|
return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.')
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
if !has('nvim')
|
|
|
|
if !has('nvim')
|
|
|
@ -503,7 +507,7 @@ if s:is_win
|
|
|
|
let batchfile = s:plug_tempname().'.bat'
|
|
|
|
let batchfile = s:plug_tempname().'.bat'
|
|
|
|
call writefile(s:wrap_cmds(a:cmd), batchfile)
|
|
|
|
call writefile(s:wrap_cmds(a:cmd), batchfile)
|
|
|
|
let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0})
|
|
|
|
let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0})
|
|
|
|
if &shell =~# 'powershell\(\.exe\)\?$'
|
|
|
|
if s:is_powershell(&shell)
|
|
|
|
let cmd = '& ' . cmd
|
|
|
|
let cmd = '& ' . cmd
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
return [batchfile, cmd]
|
|
|
|
return [batchfile, cmd]
|
|
|
@ -804,7 +808,7 @@ function! s:syntax()
|
|
|
|
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 plugDash /^-/
|
|
|
|
syn match plugDash /^-\{1}\ /
|
|
|
|
syn match plugPlus /^+/
|
|
|
|
syn match plugPlus /^+/
|
|
|
|
syn match plugStar /^*/
|
|
|
|
syn match plugStar /^*/
|
|
|
|
syn match plugMessage /\(^- \)\@<=.*/
|
|
|
|
syn match plugMessage /\(^- \)\@<=.*/
|
|
|
@ -822,6 +826,7 @@ function! s:syntax()
|
|
|
|
syn match plugError /^x.*/
|
|
|
|
syn match plugError /^x.*/
|
|
|
|
syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/
|
|
|
|
syn region plugDeleted start=/^\~ .*/ end=/^\ze\S/
|
|
|
|
syn match plugH2 /^.*:\n-\+$/
|
|
|
|
syn match plugH2 /^.*:\n-\+$/
|
|
|
|
|
|
|
|
syn match plugH2 /^-\{2,}/
|
|
|
|
syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean
|
|
|
|
syn keyword Function PlugInstall PlugStatus PlugUpdate PlugClean
|
|
|
|
hi def link plug1 Title
|
|
|
|
hi def link plug1 Title
|
|
|
|
hi def link plug2 Repeat
|
|
|
|
hi def link plug2 Repeat
|
|
|
@ -934,7 +939,7 @@ function! s:prepare(...)
|
|
|
|
call s:new_window()
|
|
|
|
call s:new_window()
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
|
|
nnoremap <silent> <buffer> q :if b:plug_preview==1<bar>pc<bar>endif<bar>bd<cr>
|
|
|
|
nnoremap <silent> <buffer> q :call <SID>close_pane()<cr>
|
|
|
|
if a:0 == 0
|
|
|
|
if a:0 == 0
|
|
|
|
call s:finish_bindings()
|
|
|
|
call s:finish_bindings()
|
|
|
|
endif
|
|
|
|
endif
|
|
|
@ -956,6 +961,15 @@ function! s:prepare(...)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
endfunction
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
function! s:close_pane()
|
|
|
|
|
|
|
|
if b:plug_preview == 1
|
|
|
|
|
|
|
|
pc
|
|
|
|
|
|
|
|
let b:plug_preview = -1
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
bd
|
|
|
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
function! s:assign_name()
|
|
|
|
function! s:assign_name()
|
|
|
|
" Assign buffer name
|
|
|
|
" Assign buffer name
|
|
|
|
let prefix = '[Plugins]'
|
|
|
|
let prefix = '[Plugins]'
|
|
|
@ -974,7 +988,7 @@ function! s:chsh(swap)
|
|
|
|
set shell=sh
|
|
|
|
set shell=sh
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
if a:swap
|
|
|
|
if a:swap
|
|
|
|
if &shell =~# 'powershell\(\.exe\)\?$' || &shell =~# 'pwsh$'
|
|
|
|
if s:is_powershell(&shell)
|
|
|
|
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s'
|
|
|
|
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s'
|
|
|
|
elseif &shell =~# 'sh' || &shell =~# 'cmd\(\.exe\)\?$'
|
|
|
|
elseif &shell =~# 'sh' || &shell =~# 'cmd\(\.exe\)\?$'
|
|
|
|
set shellredir=>%s\ 2>&1
|
|
|
|
set shellredir=>%s\ 2>&1
|
|
|
@ -1077,8 +1091,9 @@ 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)
|
|
|
|
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 output = s:system(
|
|
|
|
let output = s:system(
|
|
|
|
\ 'git 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)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
return output
|
|
|
|
return output
|
|
|
|
endfunction
|
|
|
|
endfunction
|
|
|
@ -1530,7 +1545,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 = ['git', 'fetch']
|
|
|
|
let cmd = s:git_version_requirement(2) ? ['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
|
|
|
@ -2214,7 +2229,7 @@ function! plug#shellescape(arg, ...)
|
|
|
|
let script = get(opts, 'script', 1)
|
|
|
|
let script = get(opts, 'script', 1)
|
|
|
|
if shell =~# 'cmd\(\.exe\)\?$'
|
|
|
|
if shell =~# 'cmd\(\.exe\)\?$'
|
|
|
|
return s:shellesc_cmd(a:arg, script)
|
|
|
|
return s:shellesc_cmd(a:arg, script)
|
|
|
|
elseif shell =~# 'powershell\(\.exe\)\?$' || shell =~# 'pwsh$'
|
|
|
|
elseif s:is_powershell(shell)
|
|
|
|
return s:shellesc_ps1(a:arg)
|
|
|
|
return s:shellesc_ps1(a:arg)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
return s:shellesc_sh(a:arg)
|
|
|
|
return s:shellesc_sh(a:arg)
|
|
|
@ -2266,7 +2281,7 @@ function! s:system(cmd, ...)
|
|
|
|
return system(a:cmd)
|
|
|
|
return system(a:cmd)
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"shell": &shell, "script": 0})'))
|
|
|
|
let cmd = join(map(copy(a:cmd), 'plug#shellescape(v:val, {"shell": &shell, "script": 0})'))
|
|
|
|
if &shell =~# 'powershell\(\.exe\)\?$'
|
|
|
|
if s:is_powershell(&shell)
|
|
|
|
let cmd = '& ' . cmd
|
|
|
|
let cmd = '& ' . cmd
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
else
|
|
|
|
else
|
|
|
|