From 5aa5977d744d1183806079d307f023b0c5ceaaef Mon Sep 17 00:00:00 2001 From: Maxim Kim Date: Mon, 1 Jun 2020 06:16:18 +0300 Subject: [PATCH] Handle absolute windows paths in Grep/Ag/Ripgrep sink process (#1038) Fix #1037 Function `ag_to_qf` is used to parse line produced by Grep, Ag or Ripgrep. Implementation in quesition split it using regexp that doesn't work for windows absolut paths. A better approach is to use `matchlist` function. --- autoload/fzf/vim.vim | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index a7a128d..fb37c8e 100644 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -669,11 +669,10 @@ endfunction " Ag / Rg " ------------------------------------------------------------------ function! s:ag_to_qf(line, has_column) - let parts = split(a:line, '[^:]\zs:\ze[^:]') - let text = join(parts[(a:has_column ? 3 : 2):], ':') - let dict = {'filename': &acd ? fnamemodify(parts[0], ':p') : parts[0], 'lnum': parts[1], 'text': text} + let parts = matchlist(a:line, '\(.\{-}\):\(\d\+\)\%(:\(\d\+\)\)\?\%(:\(.*\)\)\?') + let dict = {'filename': &acd ? fnamemodify(parts[1], ':p') : parts[1], 'lnum': parts[2], 'text': parts[4]} if a:has_column - let dict.col = parts[2] + let dict.col = parts[3] endif return dict endfunction