Cannot find clang-format when using with vimproc on Windows
bennyyip opened this issue · 5 comments
bennyyip commented
When I use vim-clang-format with vimproc.vim on Windows, the following message shows up.
[vimproc] vimproc#get_command_name: File "^clang-format^" is not found.
[vimproc] vimproc#get_command_name: File "^clang-format^" is not found.
Error detected while processing function clang_format#replace[16]..<SNR>143_error_message:
line 1:
clang-format has failed to format.
E474: Invalid argument
This function escapes clang-format
as ^"clang-format^"
, and vimproc cannot correctly handle shell escape for Windows.
But do we really need to escape clang-format
as ^"clang-format^"
? I tried just "clang-format"
, and it seems no problem.
Should we replace it with this?
function! s:shellescape(str) abort
if s:on_windows && (&shell =~? 'cmd\.exe')
return '"' . substitute(substitute(substitute(a:str,
\ '[&|<>()^"%]', '^\0', 'g'),
\ '\\\+\ze"', '\=repeat(submatch(0), 2)', 'g'),
\ '\^"', '\\\0', 'g') . '"'
endif
return shellescape(a:str)
endfunction
tracyone commented
I can repoduce this issue.
rhysd commented
Thank you for your investigation. I apologize missing this issue...
I think I need to remove hack on Windows in the s:shellescape()
function. I'll check why I added the hack.
rhysd commented
tracyone commented
fixed
rhysd commented
Thank you for confirming. I'll close this issue.