Skip to content
Myr

[windows/vim] Encode batchfile in current codepage

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

Backport https://github.com/junegunn/vim-plug/pull/913

authored by Junegunn Choi · committed by Junegunn Choi · parent 2b725a4 · Browse files · 1 file+2 added−6 removed
This commit

State

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

Diff stats

1 file+2 added−6 removed

  • other:+2 added−6 removed

1 file+2 added−6 removed

modified:plugin/fzf.vim+2 added-6 removed
47 unmodified lines
48 endfunction4950 " Use utf-8 for fzf.vim commands51 " Return array of shell commands for cmd.exe52 let s:codepage = libcallnr('kernel32.dll', 'GetACP', 0)53 function! s:wrap_cmds(cmds)53 let use_chcp = executable('sed')54 return map([55 \ '@echo off',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'] : [])57 \ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds])61 \ + (use_chcp ? ['chcp !origchcp! > nul'] : [])58 \ + ['endlocal'],63 \ 'v:val."\r"')59 \ printf('iconv(v:val."\r", "%s", "cp%d")', &encoding, s:codepage))60 endfunction61else62 let s:term_marker = ";#FZF"63
758 unmodified lines