1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-13 18:25:42 +08:00

fix(flygrep): fix flygrep replace mode with grep command

This commit is contained in:
Wang Shidong 2021-10-07 19:30:31 +08:00 committed by GitHub
parent 5b76a80c40
commit a7bedbc5dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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