mirror of
https://github.com/junegunn/fzf.git
synced 2025-07-26 09:42:02 -07:00
[vim/windows] Fix chcp parsing for the current codepage
https://github.com/junegunn/vim-plug/pull/888
This commit is contained in:
@@ -50,9 +50,15 @@ 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
|
||||||
function! s:wrap_cmds(cmds)
|
function! s:wrap_cmds(cmds)
|
||||||
return map(['@echo off', 'setlocal enabledelayedexpansion', 'for /f "delims=: tokens=2" %%a in (''chcp'') do set origchcp=%%a', 'set origchcp=!origchcp: =!', 'chcp 65001 > nul'] +
|
return map([
|
||||||
\ (type(a:cmds) == type([]) ? a:cmds : [a:cmds]) +
|
\ '@echo off',
|
||||||
\ ['chcp !origchcp! > nul', 'setlocal disabledelayedexpansion'], 'v:val."\r"')
|
\ 'setlocal enabledelayedexpansion',
|
||||||
|
\ 'for /f "tokens=*" %%a in (''chcp'') do for %%b in (%%a) do set origchcp=%%b',
|
||||||
|
\ 'chcp 65001 > nul'
|
||||||
|
\ ]
|
||||||
|
\ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds])
|
||||||
|
\ + ['chcp !origchcp! > nul', 'endlocal'],
|
||||||
|
\ 'v:val."\r"')
|
||||||
endfunction
|
endfunction
|
||||||
else
|
else
|
||||||
let s:term_marker = ";#FZF"
|
let s:term_marker = ";#FZF"
|
||||||
|
Reference in New Issue
Block a user