skywind3000 / asyncrun.vim

:rocket: Run Async Shell Commands in Vim 8.0 / NeoVim and Output to the Quickfix Window !!
https://www.vim.org/scripts/script.php?script_id=5431
MIT License
1.85k stars 109 forks source link

能否支持中文入参? #156

Closed foreverquiet closed 5 years ago

foreverquiet commented 5 years ago

想使用Ag来做异步检索, 但是传入参数有中文, 参数解析就会失败, 如下: noremap :AsyncRun! -cwd= ag -i --vimgrep "" ""

执行查找光标下中文, 报错如下: || [ag -i --vimgrep "错误" "E:\vim\vim-init"] || '-i' 不是内部或外部命令,也不是可运行的程序 || 或批处理文件。 || [Finished in 0 seconds with code 1]

foreverquiet commented 5 years ago

已定位问题, windows下生成临时命令文件 asyncrun.cmd, 使用了utf-8编码, writefile函数无法指定编码, 临时使用 iconv 转换为了 cp936, 配合 let g:asyncrun_trim = 1, 能正常使用了