summaryrefslogtreecommitdiffstats
path: root/autoload
diff options
context:
space:
mode:
authorMatthias P. Braendli <matthias.braendli@mpb.li>2021-11-25 15:58:34 +0100
committerMatthias P. Braendli <matthias.braendli@mpb.li>2021-11-25 15:58:34 +0100
commite946aaa3812b4406b9db74191330648b8d10f8a1 (patch)
treeb4a5f3736fb90dac7b77b00be89cb53253672e0f /autoload
parent503133b6f6fabdb42b2ba664a91ddb61eed1a34f (diff)
downloadvimrc-master.tar.gz
vimrc-master.tar.bz2
vimrc-master.zip
Updates, replace coc by lspHEADmaster
Diffstat (limited to 'autoload')
-rw-r--r--autoload/plug.vim30
1 files changed, 22 insertions, 8 deletions
diff --git a/autoload/plug.vim b/autoload/plug.vim
index c1657f2..b6e4cbf 100644
--- a/autoload/plug.vim
+++ b/autoload/plug.vim
@@ -116,6 +116,10 @@ let s:TYPE = {
let s:loaded = get(s:, 'loaded', {})
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
return a:dir =~# '^/' || (has('win32') && a:dir =~? '^\%(\\\|[A-Z]:\)')
endfunction
@@ -263,7 +267,7 @@ function! s:define_commands()
endif
if has('win32')
\ && &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.')
endif
if !has('nvim')
@@ -503,7 +507,7 @@ if s:is_win
let batchfile = s:plug_tempname().'.bat'
call writefile(s:wrap_cmds(a:cmd), batchfile)
let cmd = plug#shellescape(batchfile, {'shell': &shell, 'script': 0})
- if &shell =~# 'powershell\(\.exe\)\?$'
+ if s:is_powershell(&shell)
let cmd = '& ' . cmd
endif
return [batchfile, cmd]
@@ -935,7 +939,7 @@ function! s:prepare(...)
call s:new_window()
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
call s:finish_bindings()
endif
@@ -957,6 +961,15 @@ function! s:prepare(...)
endif
endfunction
+function! s:close_pane()
+ if b:plug_preview == 1
+ pc
+ let b:plug_preview = -1
+ else
+ bd
+ endif
+endfunction
+
function! s:assign_name()
" Assign buffer name
let prefix = '[Plugins]'
@@ -975,7 +988,7 @@ function! s:chsh(swap)
set shell=sh
endif
if a:swap
- if &shell =~# 'powershell\(\.exe\)\?$' || &shell =~# 'pwsh$'
+ if s:is_powershell(&shell)
let &shellredir = '2>&1 | Out-File -Encoding UTF8 %s'
elseif &shell =~# 'sh' || &shell =~# 'cmd\(\.exe\)\?$'
set shellredir=>%s\ 2>&1
@@ -1195,7 +1208,8 @@ function! s:update_impl(pull, force, args) abort
normal! 2G
silent! redraw
- let s:clone_opt = []
+ " Set remote name, overriding a possible user git config's clone.defaultRemoteName
+ let s:clone_opt = ['--origin', 'origin']
if get(g:, 'plug_shallow', 1)
call extend(s:clone_opt, ['--depth', '1'])
if s:git_version_requirement(1, 7, 10)
@@ -1532,7 +1546,7 @@ while 1 " Without TCO, Vim stack is bound to explode
let [error, _] = s:git_validate(spec, 0)
if empty(error)
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'))
call extend(cmd, ['--depth', '99999999'])
endif
@@ -2216,7 +2230,7 @@ function! plug#shellescape(arg, ...)
let script = get(opts, 'script', 1)
if shell =~# 'cmd\(\.exe\)\?$'
return s:shellesc_cmd(a:arg, script)
- elseif shell =~# 'powershell\(\.exe\)\?$' || shell =~# 'pwsh$'
+ elseif s:is_powershell(shell)
return s:shellesc_ps1(a:arg)
endif
return s:shellesc_sh(a:arg)
@@ -2268,7 +2282,7 @@ function! s:system(cmd, ...)
return system(a:cmd)
endif
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
endif
else