mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-05-29 13:50:47 +00:00
[vim/windows] Use chcp only if sed is in PATH
https://github.com/junegunn/vim-plug/pull/891
This commit is contained in:
parent
072066c49c
commit
6390140539
|
@ -50,14 +50,16 @@ if s:is_win
|
|||
" Use utf-8 for fzf.vim commands
|
||||
" Return array of shell commands for cmd.exe
|
||||
function! s:wrap_cmds(cmds)
|
||||
let use_chcp = executable('sed')
|
||||
return map([
|
||||
\ '@echo off',
|
||||
\ 'setlocal enabledelayedexpansion',
|
||||
\ 'for /f "tokens=*" %%a in (''chcp'') do for %%b in (%%a) do set origchcp=%%b',
|
||||
\ 'chcp 65001 > nul'
|
||||
\ ]
|
||||
\ '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])
|
||||
\ + ['chcp !origchcp! > nul', 'endlocal'],
|
||||
\ + (use_chcp ? ['chcp !origchcp! > nul'] : [])
|
||||
\ + ['endlocal'],
|
||||
\ 'v:val."\r"')
|
||||
endfunction
|
||||
else
|
||||
|
|
Loading…
Reference in New Issue
Block a user