diff --git a/plugin/fzf.vim b/plugin/fzf.vim index a138c4f..6055b24 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -50,9 +50,9 @@ if s:is_win " Use utf-8 for fzf.vim commands " Return array of shell commands for cmd.exe function! s:wrap_cmds(cmds) - return map(['@echo off', 'for /f "tokens=4" %%a in (''chcp'') do set origchcp=%%a', 'chcp 65001 > nul'] + + return map(['@echo off', 'setlocal enabledelayedexpansion', 'for /f "delims=: tokens=2" %%a in (''chcp'') do set origchcp=%%a', 'set origchcp=!origchcp: =!', 'chcp 65001 > nul'] + \ (type(a:cmds) == type([]) ? a:cmds : [a:cmds]) + - \ ['chcp %origchcp% > nul'], 'v:val."\r"') + \ ['chcp !origchcp! > nul', 'setlocal disabledelayedexpansion'], 'v:val."\r"') endfunction else let s:term_marker = ";#FZF"