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

2.06 breaks RipGrep on Linux #140

Closed bennyyip closed 5 years ago

bennyyip commented 5 years ago

2.06 changes the way how stdin is handled. https://github.com/skywind3000/asyncrun.vim/blob/master/plugin/asyncrun.vim#L679 sets l:options['in_io'] to 'pipe', which should be 'null' for rg.

skywind3000 commented 5 years ago

怎么 break 了?我测试了 rg 没问题啊,你的命令是啥?

skywind3000 commented 5 years ago

如果 null,又会 break windows下面的 cmake.

bennyyip commented 5 years ago

@skywind3000 :AsyncRun rg foo,返回错误码1。 我觉得保留原来的g:asyncrun_stdin选项挺好的。

skywind3000 commented 5 years ago

恩,恢复了。

skywind3000 commented 5 years ago

我稍微研究了一下,你如果 stdin=pipe 的情况下 rg foo 是会有问题的,然而:

:AsyncRun rg  foo %:p:h

后面跟一个路径名的话,rg 就不需要依赖 stdin=null 了

skywind3000 commented 5 years ago

或者你写明显点:

:AsyncRun rg foo < /dev/null
bennyyip commented 5 years ago

https://github.com/bennyyip/dot-vim/commit/4e510142344719c58d87b26c164bfb5c0cf3b47f 我把路径加上了。

skywind3000 commented 5 years ago

严格的讲,这一行:

let l:cmd .= "@ rg -S --vimgrep " . a:args . ' ' . l:path

应该是:

let l:cmd .= "@ rg -S --vimgrep " . a:args . '  "' . l:path . '"'

或者

let l:cmd .= "@ rg -S --vimgrep " . a:args . ' ' . shellescape(l:path)

小心包含空格的参数。

bennyyip commented 5 years ago

谢谢,我改过来了