Use chcp only if sed is in PATH
This commit is contained in:
parent
849b76be90
commit
c4896c3873
12
plug.vim
12
plug.vim
|
@ -353,14 +353,16 @@ if s:is_win
|
||||||
|
|
||||||
" Copied from fzf
|
" Copied from fzf
|
||||||
function! s:wrap_cmds(cmds)
|
function! s:wrap_cmds(cmds)
|
||||||
|
let use_chcp = executable('sed')
|
||||||
return map([
|
return map([
|
||||||
\ '@echo off',
|
\ '@echo off',
|
||||||
\ 'setlocal enabledelayedexpansion',
|
\ 'setlocal enabledelayedexpansion']
|
||||||
\ 'for /f "tokens=*" %%a in (''chcp'') do for %%b in (%%a) do set origchcp=%%b',
|
\ + (use_chcp ? [
|
||||||
\ 'chcp 65001 > nul'
|
\ '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])
|
\ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds])
|
||||||
\ + ['chcp !origchcp! > nul', 'endlocal'],
|
\ + (use_chcp ? ['chcp !origchcp! > nul'] : [])
|
||||||
|
\ + ['endlocal'],
|
||||||
\ 'v:val."\r"')
|
\ 'v:val."\r"')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user