From a7bedbc5dc76809b6f28c1f21b1b6a36b459dabd Mon Sep 17 00:00:00 2001 From: Wang Shidong Date: Thu, 7 Oct 2021 19:30:31 +0800 Subject: [PATCH] fix(flygrep): fix flygrep replace mode with grep command --- autoload/SpaceVim/plugins/flygrep.vim | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/autoload/SpaceVim/plugins/flygrep.vim b/autoload/SpaceVim/plugins/flygrep.vim index cb47c78ca..eedac9048 100644 --- a/autoload/SpaceVim/plugins/flygrep.vim +++ b/autoload/SpaceVim/plugins/flygrep.vim @@ -279,7 +279,13 @@ function! s:flygrep_result_to_files() abort for line in getbufline(s:flygrep_buffer_id, 1, '$') let filename = fnameescape(split(line, ':\d\+:')[0]) let linenr = matchstr(line, ':\d\+:')[1:-2] - let str = matchstr(line, '\(:\d\+:\d\+:\)\@<=.*') + " if the search command is grep, the searching result is + " helloworld.vim:12: echo 'hello' + " echo matchstr("helloworld.vim:12: echo 'hello'", '\(:\d\+:\)\@<=.*') + " ` echo 'hello'` + " echo matchstr("helloworld.vim:1:12: echo 'hello'", '\(:\d\+:\)\@<=.*') + " ` echo 'hello'` + let str = matchstr(line, '\(:\d\+:\)\@<=.*') call add(files, [filename, linenr, str]) endfor return files