|
1 | 1 | " File: grep.vim |
2 | 2 | " Author: Yegappan Lakshmanan (yegappan AT yahoo DOT com) |
3 | 3 | " Version: 2.1 |
4 | | -" Last Modified: March 4, 2018 |
| 4 | +" Last Modified: March 11, 2018 |
5 | 5 | " |
6 | 6 | " Plugin to integrate grep like utilities with Vim |
7 | 7 | " Supported ones are: grep, fgrep, egrep, agrep, findstr, ag, ack, ripgrep |
@@ -232,7 +232,7 @@ endfunction |
232 | 232 | function! grep#cmd_output_cb(qf_id, channel, msg) |
233 | 233 | let job = ch_getjob(a:channel) |
234 | 234 | if job_status(job) == 'fail' |
235 | | - call warnMsg('Error: Job not found in grep command output callback') |
| 235 | + call s:warnMsg('Error: Job not found in grep command output callback') |
236 | 236 | return |
237 | 237 | endif |
238 | 238 |
|
@@ -262,7 +262,7 @@ endfunction |
262 | 262 | function! grep#chan_close_cb(qf_id, channel) |
263 | 263 | let job = ch_getjob(a:channel) |
264 | 264 | if job_status(job) == 'fail' |
265 | | - call warnMsg('Error: Job not found in grep channel close callback') |
| 265 | + call s:warnMsg('Error: Job not found in grep channel close callback') |
266 | 266 | return |
267 | 267 | endif |
268 | 268 | let emsg = '[Search command exited with status ' . job_info(job).exitval . ']' |
@@ -325,7 +325,8 @@ function! s:runGrepCmdAsync(cmd, pattern, action) |
325 | 325 | let s:grep_cmd_job = job_start(cmd_list, |
326 | 326 | \ {'callback' : function('grep#cmd_output_cb', [qf_id]), |
327 | 327 | \ 'close_cb' : function('grep#chan_close_cb', [qf_id]), |
328 | | - \ 'exit_cb' : function('grep#cmd_exit_cb', [qf_id])}) |
| 328 | + \ 'exit_cb' : function('grep#cmd_exit_cb', [qf_id]), |
| 329 | + \ 'in_io' : 'null'}) |
329 | 330 |
|
330 | 331 | if job_status(s:grep_cmd_job) == 'fail' |
331 | 332 | let s:grep_cmd_job = 0 |
@@ -478,13 +479,6 @@ function! s:formFullCmd(cmd_name, useropts, pattern, filenames) |
478 | 479 | \ a:pattern . ' ' . a:filenames . ' ' . |
479 | 480 | \ s:cmdTable[a:cmd_name].nulldev |
480 | 481 |
|
481 | | - " Some commands like ripgrep try to read from stdin. This hangs the |
482 | | - " command as Vim controls stdin. To avoid this problem, redirect stdin to |
483 | | - " the NULL device for commands that search recursively by default. |
484 | | - if s:recursive_search_cmd(a:cmd_name) |
485 | | - let fullcmd = fullcmd . ' < ' . g:Grep_Null_Device |
486 | | - endif |
487 | | - |
488 | 482 | return fullcmd |
489 | 483 | endfunction |
490 | 484 |
|
@@ -517,7 +511,7 @@ function! s:getListOfArgFiles() |
517 | 511 |
|
518 | 512 | let arg_cnt = argc() |
519 | 513 | if arg_cnt != 0 |
520 | | - for i in range(0, arg_cnt) |
| 514 | + for i in range(0, arg_cnt - 1) |
521 | 515 | let filenames = filenames . ' ' . argv(i) |
522 | 516 | endfor |
523 | 517 | endif |
|
0 commit comments