Skip to content
Myr

[vim/windows] Use chcp only if sed is in PATH

Before adoption: this commit came in with the history the project adopted, so no landing records it.

https://github.com/junegunn/vim-plug/pull/891

authored by Junegunn Choi · committed by Junegunn Choi · parent 072066c · Browse files · 1 file+7 added−5 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Trailers

  • https: //github.com/junegunn/vim-plug/pull/891

Diff stats

1 file+7 added−5 removed

  • other:+7 added−5 removed

1 file+7 added−5 removed

modified:plugin/fzf.vim+7 added-5 removed
48 unmodified lines
4950 " Use utf-8 for fzf.vim commands51 " Return array of shell commands for cmd.exe52 function! s:wrap_cmds(cmds)53 let use_chcp = executable('sed')54 return map([55 \ '@echo off',55 \ 'setlocal enabledelayedexpansion',56 \ 'for /f "tokens=*" %%a in (''chcp'') do for %%b in (%%a) do set origchcp=%%b',57 \ 'chcp 65001 > nul'58 \ ]56 \ 'setlocal enabledelayedexpansion']57 \ + (use_chcp ? [58 \ 'for /f "usebackq" %%a in (`chcp ^| sed "s/[^0-9]//gp"`) do set origchcp=%%a',59 \ 'chcp 65001 > nul'] : [])60 \ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds])60 \ + ['chcp !origchcp! > nul', 'endlocal'],61 \ + (use_chcp ? ['chcp !origchcp! > nul'] : [])62 \ + ['endlocal'],63 \ 'v:val."\r"')64 endfunction65else66 let s:term_marker = ";#FZF"
755 unmodified lines