Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix support for using ripgrep with vim-dispatch #276

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 23 additions & 1 deletion autoload/ack.vim
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,23 @@ function! s:Init(cmd) "{{{
endif
endfunction "}}}

function! s:NeedToAppendPwd(grepprg, grepargs) "{{{
let l:binary_append_needed = ['rg', 'ripgrep']
let l:folders = split(a:grepprg, '/')
let l:program = split(l:folders[-1], ' ')
if index(l:binary_append_needed, l:program[0]) >= 0
" Check if user supplied directory arguments to grepprg
let l:args = split(a:grepargs)
if !isdirectory(l:args[-1])
return 1
else
return 0
endif
else
return 0
endif
endfunction "}}}

function! s:QuickHelp() "{{{
execute 'edit' globpath(&rtp, 'doc/ack_quick_help.txt')

Expand All @@ -193,8 +210,13 @@ function! s:SearchWithDispatch(grepprg, grepargs, grepformat) "{{{
let l:grepprg = a:grepprg
endif

let l:grepargs = a:grepargs
if s:NeedToAppendPwd(a:grepprg, a:grepargs)
let l:grepargs = l:grepargs . ' ' . getcwd()
endif

try
let &l:makeprg = l:grepprg . ' ' . a:grepargs
let &l:makeprg = l:grepprg . ' ' . l:grepargs
let &l:errorformat = a:grepformat

Make
Expand Down