PlugUpgrade

Fri, 18 Oct 2019 17:01:35 -0500

author
Meredith Howard <mhoward@roomag.org>
date
Fri, 18 Oct 2019 17:01:35 -0500
changeset 806
fb0c343bb872
parent 805
59b23772424a
child 807
afc9c88b4897

PlugUpgrade

.vim/autoload/plug.vim file | annotate | diff | comparison | revisions
--- a/.vim/autoload/plug.vim
+++ b/.vim/autoload/plug.vim
@@ -353,9 +353,17 @@ if s:is_win
 
   " Copied from fzf
   function! s:wrap_cmds(cmds)
-    return map(['@echo off','setlocal enabledelayedexpansion','for /f "delims=: tokens=2" %%a in (''chcp'') do set origchcp=%%a','set origchcp=!origchcp: =!','chcp 65001 > nul'] +
-    \ (type(a:cmds) == type([]) ? a:cmds : [a:cmds]) +
-    \ ['chcp !origchcp! > nul','setlocal disabledelayedexpansion'],'v:val."\r"')
+    let use_chcp = executable('sed')
+    return map([
+      \ '@echo off',
+      \ 'setlocal enabledelayedexpansion']
+    \ + (use_chcp ? [
+      \ 'for /f "usebackq" %%a in (`chcp ^| sed "s/[^0-9]//gp"`) do set origchcp=%%a',
+      \ 'chcp 65001 > nul'] : [])
+    \ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds])
+    \ + (use_chcp ? ['chcp !origchcp! > nul'] : [])
+    \ + ['endlocal'],
+    \ 'v:val."\r"')
   endfunction
 
   function! s:batchfile(cmd)
@@ -1028,7 +1036,7 @@ function! s:update_impl(pull, force, arg
   let s:clone_opt = get(g:, 'plug_shallow', 1) ?
         \ '--depth 1' . (s:git_version_requirement(1, 7, 10) ? ' --no-single-branch' : '') : ''
 
-  if has('win32unix')
+  if has('win32unix') || has('wsl')
     let s:clone_opt .= ' -c core.eol=lf -c core.autocrlf=input'
   endif
 

mercurial