mirror of
https://github.com/junegunn/vim-plug.git
synced 2024-12-23 20:45:31 -07:00
Use iconv() only if +iconv is enabled. (#921)
TODO: Avoid iconv() for commands using ascii only.
This commit is contained in:
parent
359ce90b9b
commit
b2aa5724c0
17
plug.vim
17
plug.vim
@ -184,8 +184,8 @@ function! s:define_commands()
|
|||||||
endif
|
endif
|
||||||
if !has('nvim')
|
if !has('nvim')
|
||||||
\ && (has('win32') || has('win32unix'))
|
\ && (has('win32') || has('win32unix'))
|
||||||
\ && (!has('multi_byte') || !has('iconv'))
|
\ && !has('multi_byte')
|
||||||
return s:err('Vim needs +iconv, +multi_byte features on Windows to run shell commands.')
|
return s:err('Vim needs +multi_byte feature on Windows to run shell commands. Enable +iconv for best results.')
|
||||||
endif
|
endif
|
||||||
command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(<bang>0, [<f-args>])
|
command! -nargs=* -bar -bang -complete=customlist,s:names PlugInstall call s:install(<bang>0, [<f-args>])
|
||||||
command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(<bang>0, [<f-args>])
|
command! -nargs=* -bar -bang -complete=customlist,s:names PlugUpdate call s:update(<bang>0, [<f-args>])
|
||||||
@ -400,14 +400,19 @@ if s:is_win
|
|||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" Copied from fzf
|
" Copied from fzf
|
||||||
let s:codepage = libcallnr('kernel32.dll', 'GetACP', 0)
|
|
||||||
function! s:wrap_cmds(cmds)
|
function! s:wrap_cmds(cmds)
|
||||||
return map([
|
let cmds = [
|
||||||
\ '@echo off',
|
\ '@echo off',
|
||||||
\ 'setlocal enabledelayedexpansion']
|
\ 'setlocal enabledelayedexpansion']
|
||||||
\ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds])
|
\ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds])
|
||||||
\ + ['endlocal'],
|
\ + ['endlocal']
|
||||||
\ printf('iconv(v:val."\r", "%s", "cp%d")', &encoding, s:codepage))
|
if has('iconv')
|
||||||
|
if !exists('s:codepage')
|
||||||
|
let s:codepage = libcallnr('kernel32.dll', 'GetACP', 0)
|
||||||
|
endif
|
||||||
|
return map(cmds, printf('iconv(v:val."\r", "%s", "cp%d")', &encoding, s:codepage))
|
||||||
|
endif
|
||||||
|
return map(cmds, 'v:val."\r"')
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:batchfile(cmd)
|
function! s:batchfile(cmd)
|
||||||
|
Loading…
Reference in New Issue
Block a user