Skip to content
Myr

[vim] Encode list source to codepage (#1794)

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

authored by Jan Edmund Lazo · committed by Junegunn Choi · parent aa0e10e · Browse files · 1 file+9 added−2 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+9 added−2 removed

  • other:+9 added−2 removed

1 file+9 added−2 removed

modified:plugin/fzf.vim+9 added-2 removed
48 unmodified lines
4950 " 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:enc_to_cp(str)54 return iconv(a:str, &encoding, 'cp'.s:codepage)55 endfunction56 function! s:wrap_cmds(cmds)57 return map([58 \ '@echo off',59 \ 'setlocal enabledelayedexpansion']60 \ + (has('gui_running') ? ['set TERM= > nul'] : [])61 \ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds])62 \ + ['endlocal'],60 \ printf('iconv(v:val."\r", "%s", "cp%d")', &encoding, s:codepage))63 \ '<SID>enc_to_cp(v:val."\r")')64 endfunction65else66 let s:term_marker = ";#FZF"67
3 unmodified lines
7172 function! s:wrap_cmds(cmds)73 return a:cmds74 endfunction7576 function! s:enc_to_cp(str)77 return a:str78 endfunction79endif8081function! s:shellesc_cmd(arg)82 let escaped = substitute(a:arg, '[&|<>()@^]', '^&', 'g')
307 unmodified lines
390 if type == 1391 let prefix = '( '.source.' )|'392 elseif type == 3393 let temps.input = s:fzf_tempname()387 call writefile(source, temps.input)394 call writefile(map(source, '<SID>enc_to_cp(v:val)'), temps.input)395 let prefix = (s:is_win ? 'type ' : 'cat ').fzf#shellescape(temps.input).'|'396 else397 throw 'Invalid source type'398 endif
433 unmodified lines