dotfiles/nvim/.config/nvim/plugin/grepper.vim
Sanchayan Maity 467a660409 nvim: Drop neomake, QFGrep and vim-grepper
Profiling with below
nvim -c 'profile start vim.log' -c 'profile func *' -c 'q'

shows that neomake adds to the start up time. Currently we only use it
for two tasks. Running hlint for Haskell and stack build asynchronously.

Use asyncdo and define a generic wrapper command for running makeprg
asynchronously. This can be used for anything as long as makeprg is
set correctly.

vim-grepper also adds somewhat to the startup time though not much. We
do not need the functionality of switching between grep tools. Here
again just use asyncdo and define a generic command for running grepprg
asynchronously.

Drop QFGrep as we can use in built Cfilter plugin for filtering the
quickfix list.

Note that all start times mentioned above are a few milliseconds not
even more than 5ms. However, we would like to be as fast as possible
and use in built functions.

Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
2020-05-21 16:39:06 +05:30

20 lines
736 B
VimL

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(<bang>0,
\ { 'job': &grepprg, 'errorformat': &grepformat }, <f-args>)
command! -bang -nargs=* -complete=dir LGrep call asyncdo#lrun(<bang>0,
\ { 'job': &grepprg, 'errorformat': &grepformat }, <f-args>)
augroup GrepperQFOpen
autocmd!
autocmd QuickFixCmdPost [^l]* nested cwindow
autocmd QuickFixCmdPost l* nested lwindow
augroup END