diff options
author | Junegunn Choi <junegunn.c@gmail.com> | 2019-10-08 09:41:22 +0900 |
---|---|---|
committer | Junegunn Choi <junegunn.c@gmail.com> | 2019-10-08 09:41:22 +0900 |
commit | 3089880f18b2a0b5663554876468de6c8f17eb8c (patch) | |
tree | cdab4516ad07c9df4cdfda972095d8c3bf3764d9 | |
parent | ab11b74be4b0c9fac88d95f0f563d0dc0cb06ed3 (diff) |
[vim/windows] Fix chcp parsing for the current codepage
https://github.com/junegunn/vim-plug/pull/888
-rw-r--r-- | plugin/fzf.vim | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/plugin/fzf.vim b/plugin/fzf.vim index 6055b245..ac4c98fd 100644 --- a/plugin/fzf.vim +++ b/plugin/fzf.vim @@ -50,9 +50,15 @@ 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', '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', 'setlocal disabledelayedexpansion'], 'v:val."\r"') + return map([ + \ '@echo off', + \ '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 else let s:term_marker = ";#FZF" |