mirror of
https://github.com/Llewellynvdm/fzf.git
synced 2024-11-22 04:45:14 +00:00
[windows/vim] Encode batchfile in current codepage
Backport https://github.com/junegunn/vim-plug/pull/913
This commit is contained in:
parent
2b725a4db5
commit
f68017d21e
@ -49,18 +49,14 @@ if s:is_win
|
|||||||
|
|
||||||
" Use utf-8 for fzf.vim commands
|
" Use utf-8 for fzf.vim commands
|
||||||
" Return array of shell commands for cmd.exe
|
" Return array of shell commands for cmd.exe
|
||||||
|
let s:codepage = libcallnr('kernel32.dll', 'GetACP', 0)
|
||||||
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']
|
||||||
\ + (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])
|
\ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds])
|
||||||
\ + (use_chcp ? ['chcp !origchcp! > nul'] : [])
|
|
||||||
\ + ['endlocal'],
|
\ + ['endlocal'],
|
||||||
\ 'v:val."\r"')
|
\ printf('iconv(v:val."\r", "%s", "cp%d")', &encoding, s:codepage))
|
||||||
endfunction
|
endfunction
|
||||||
else
|
else
|
||||||
let s:term_marker = ";#FZF"
|
let s:term_marker = ";#FZF"
|
||||||
|
Loading…
Reference in New Issue
Block a user