Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions plug.vim
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,11 @@ function! s:define_commands()
\ && (&shell =~# 'cmd\.exe' || &shell =~# 'powershell\.exe')
return s:err('vim-plug does not support shell, ' . &shell . ', when shellslash is set.')
endif
if !has('nvim')
\ && (has('win32') || has('win32unix'))
\ && (!has('multi_byte') || !has('iconv'))
return s:err('Vim needs +iconv, +multi_byte features on Windows to run shell commands.')
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 PlugUpdate call s:update(<bang>0, [<f-args>])
command! -nargs=0 -bar -bang PlugClean call s:clean(<bang>0)
Expand Down Expand Up @@ -395,18 +400,14 @@ if s:is_win
endfunction

" Copied from fzf
let s:codepage = libcallnr('kernel32.dll', 'GetACP', 0)
function! s:wrap_cmds(cmds)
let use_chcp = executable('sed')
return map([
\ '@echo off',
\ 'setlocal enabledelayedexpansion']
\ + (use_chcp ? [
\ 'for /f "usebackq" %%a in (`chcp ^| sed "s/[^0-9]//gp"`) do set origchcp=%%a',
\ 'chcp 65001 > nul'] : [])
\ + (type(a:cmds) == type([]) ? a:cmds : [a:cmds])
\ + (use_chcp ? ['chcp !origchcp! > nul'] : [])
\ + ['endlocal'],
\ 'v:val."\r"')
\ printf('iconv(v:val."\r", "%s", "cp%d")', &encoding, s:codepage))
endfunction

function! s:batchfile(cmd)
Expand Down