if executable('rg') set grepprg=rg\ --vimgrep\ --no-heading\ --smart-case set grepformat=%f:%l:%c:%m,%f:%l%m,%f\ \ %l%m elseif executable('ag') set grepprg=ag\ --nogroup\ --nocolor\ --vimgrep set grepformat^=%f:%l:%c:%m endif " Taken from https://github.com/hauleth/dotfiles/blob/master/vim/.config/nvim/init.vim command! -bang -nargs=* -complete=dir Grep call asyncdo#run(0, \ { 'job': &grepprg, 'errorformat': &grepformat }, ) command! -bang -nargs=* -complete=dir LGrep call asyncdo#lrun(0, \ { 'job': &grepprg, 'errorformat': &grepformat }, ) augroup GrepperQFOpen autocmd! autocmd QuickFixCmdPost [^l]* nested cwindow autocmd QuickFixCmdPost l* nested lwindow augroup END