@@ -139,6 +139,11 @@ function! s:define_commands()
139139  if  ! executable (' git'  )
140140    return  s: err (' `git` executable not found. Most commands will not be available. To suppress this message, prepend `silent!` to `call plug#begin(...)`.'  )
141141  endif 
142+   if  ! has (' nvim'  )
143+     \  &&  (has (' win32'  ) ||  has (' win32unix'  ))
144+     \  &&  (! has (' multi-byte'  ) ||  &encoding  !=#  ' utf-8'  )
145+     return  s: err (' Only Vim with +multi_byte feature is supported. Add `set encoding=utf-8` in your vimrc before running `plug#begin()`.'  )
146+   endif 
142147  command !  -nargs =*  - bar  - bang  -complete =customlist ,s: names  PlugInstall call  s: install (<bang> 0 , [<f-args> ])
143148  command !  -nargs =*  - bar  - bang  -complete =customlist ,s: names  PlugUpdate  call  s: update (<bang> 0 , [<f-args> ])
144149  command !  -nargs =0  - bar  - bang  PlugClean call  s: clean (<bang> 0 )
@@ -353,24 +358,19 @@ if s:is_win
353358
354359  "  Copied from fzf 
355360  function !  s: wrap_cmds (cmds)
356-     let  use_chcp =  executable (' sed'  )
357361    return  map ([
358362      \  ' @echo off'  ,
359363      \  ' setlocal enabledelayedexpansion'  ]
360-     \  +  (use_chcp ? [
361-       \  ' for /f "usebackq" %%a in (`chcp ^| sed "s/[^0-9]//gp"`) do set origchcp=%%a'  ,
362-       \  ' chcp 65001 > nul'  ] : [])
363364    \  +  (type (a: cmds ) ==  type ([]) ? a: cmds  : [a: cmds ])
364-     \  +  (use_chcp ? [' chcp !origchcp! > nul'  ] : [])
365365    \  +  [' endlocal'  ],
366366    \  ' v:val."\r"'  )
367367  endfunction 
368368
369369  function !  s: batchfile (cmd)
370370    let  batchfile =  tempname ().' .bat' 
371371    call  writefile (s: wrap_cmds (a: cmd ), batchfile)
372-     let  cmd =  plug#shellescape (batchfile, {' shell'  : &shell , ' script'  : 1 })
373-     if  &shell  = ~# ' powershell\.exe$ ' 
372+     let  cmd =  plug#shellescape (batchfile, {' shell'  : &shell , ' script'  : 0 })
373+     if  &shell  = ~# ' powershell\.exe' 
374374      let  cmd =  ' & '   . cmd
375375    endif 
376376    return  [batchfile, cmd]
@@ -2005,9 +2005,9 @@ function! plug#shellescape(arg, ...)
20052005  let  opts =  a: 0 >  0  &&  type (a: 1 ) ==  s: TYPE .dict  ? a: 1  : {}
20062006  let  shell  =  get (opts, ' shell'  , s: is_win  ? ' cmd.exe'   : ' sh'  )
20072007  let  script  =  get (opts, ' script'  , 1 )
2008-   if  shell  = ~# ' cmd\.exe$ ' 
2008+   if  shell  = ~# ' cmd\.exe' 
20092009    return  s: shellesc_cmd (a: arg , script )
2010-   elseif  shell  = ~# ' powershell\.exe$ '   ||  shell  = ~# ' pwsh$' 
2010+   elseif  shell  = ~# ' powershell\.exe'   ||  shell  = ~# ' pwsh$' 
20112011    return  s: shellesc_ps1 (a: arg )
20122012  endif 
20132013  return  shellescape (a: arg )
0 commit comments