|
@@ -434,8 +434,8 @@ endfunction
|
|
|
|
|
|
|
|
function! s:dobufread(names)
|
|
function! s:dobufread(names)
|
|
|
for name in a:names
|
|
for name in a:names
|
|
|
- let path = s:rtp(g:plugs[name]).'/**'
|
|
|
|
|
- for dir in ['ftdetect', 'ftplugin']
|
|
|
|
|
|
|
+ let path = s:rtp(g:plugs[name])
|
|
|
|
|
+ for dir in ['ftdetect', 'ftplugin', 'after/ftdetect', 'after/ftplugin']
|
|
|
if len(finddir(dir, path))
|
|
if len(finddir(dir, path))
|
|
|
if exists('#BufRead')
|
|
if exists('#BufRead')
|
|
|
doautocmd BufRead
|
|
doautocmd BufRead
|
|
@@ -794,9 +794,7 @@ endfunction
|
|
|
|
|
|
|
|
function! s:chsh(swap)
|
|
function! s:chsh(swap)
|
|
|
let prev = [&shell, &shellcmdflag, &shellredir]
|
|
let prev = [&shell, &shellcmdflag, &shellredir]
|
|
|
- if s:is_win
|
|
|
|
|
- set shell=cmd.exe shellcmdflag=/c shellredir=>%s\ 2>&1
|
|
|
|
|
- elseif a:swap
|
|
|
|
|
|
|
+ if !s:is_win && a:swap
|
|
|
set shell=sh shellredir=>%s\ 2>&1
|
|
set shell=sh shellredir=>%s\ 2>&1
|
|
|
endif
|
|
endif
|
|
|
return prev
|
|
return prev
|
|
@@ -811,7 +809,7 @@ function! s:bang(cmd, ...)
|
|
|
if s:is_win
|
|
if s:is_win
|
|
|
let batchfile = tempname().'.bat'
|
|
let batchfile = tempname().'.bat'
|
|
|
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
|
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
|
|
- let cmd = batchfile
|
|
|
|
|
|
|
+ let cmd = s:shellesc(expand(batchfile))
|
|
|
endif
|
|
endif
|
|
|
let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%')
|
|
let g:_plug_bang = (s:is_win && has('gui_running') ? 'silent ' : '').'!'.escape(cmd, '#!%')
|
|
|
execute "normal! :execute g:_plug_bang\<cr>\<cr>"
|
|
execute "normal! :execute g:_plug_bang\<cr>\<cr>"
|
|
@@ -1210,7 +1208,7 @@ function! s:spawn(name, cmd, opts)
|
|
|
let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd
|
|
let cmd = has_key(a:opts, 'dir') ? s:with_cd(a:cmd, a:opts.dir) : a:cmd
|
|
|
if !empty(job.batchfile)
|
|
if !empty(job.batchfile)
|
|
|
call writefile(["@echo off\r", cmd . "\r"], job.batchfile)
|
|
call writefile(["@echo off\r", cmd . "\r"], job.batchfile)
|
|
|
- let cmd = job.batchfile
|
|
|
|
|
|
|
+ let cmd = s:shellesc(expand(job.batchfile))
|
|
|
endif
|
|
endif
|
|
|
let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd)
|
|
let argv = add(s:is_win ? ['cmd', '/c'] : ['sh', '-c'], cmd)
|
|
|
|
|
|
|
@@ -2037,9 +2035,9 @@ function! s:system(cmd, ...)
|
|
|
if s:is_win
|
|
if s:is_win
|
|
|
let batchfile = tempname().'.bat'
|
|
let batchfile = tempname().'.bat'
|
|
|
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
|
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
|
|
- let cmd = batchfile
|
|
|
|
|
|
|
+ let cmd = s:shellesc(expand(batchfile))
|
|
|
endif
|
|
endif
|
|
|
- return system(s:is_win ? '('.cmd.')' : cmd)
|
|
|
|
|
|
|
+ return system(cmd)
|
|
|
finally
|
|
finally
|
|
|
let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
|
|
let [&shell, &shellcmdflag, &shellredir] = [sh, shellcmdflag, shrd]
|
|
|
if s:is_win
|
|
if s:is_win
|
|
@@ -2224,7 +2222,7 @@ function! s:upgrade()
|
|
|
let new = tmp . '/plug.vim'
|
|
let new = tmp . '/plug.vim'
|
|
|
|
|
|
|
|
try
|
|
try
|
|
|
- let out = s:system(printf('git clone --depth 1 %s %s', s:plug_src, tmp))
|
|
|
|
|
|
|
+ let out = s:system(printf('git clone --depth 1 %s %s', s:shellesc(s:plug_src), s:shellesc(tmp)))
|
|
|
if v:shell_error
|
|
if v:shell_error
|
|
|
return s:err('Error upgrading vim-plug: '. out)
|
|
return s:err('Error upgrading vim-plug: '. out)
|
|
|
endif
|
|
endif
|
|
@@ -2371,7 +2369,7 @@ function! s:preview_commit()
|
|
|
if s:is_win
|
|
if s:is_win
|
|
|
let batchfile = tempname().'.bat'
|
|
let batchfile = tempname().'.bat'
|
|
|
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
|
call writefile(["@echo off\r", cmd . "\r"], batchfile)
|
|
|
- let cmd = batchfile
|
|
|
|
|
|
|
+ let cmd = expand(batchfile)
|
|
|
endif
|
|
endif
|
|
|
execute 'silent %!' cmd
|
|
execute 'silent %!' cmd
|
|
|
finally
|
|
finally
|