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>
This commit is contained in:
Sanchayan Maity 2020-05-21 13:19:13 +05:30
parent 3b7326b6ed
commit 467a660409
7 changed files with 47 additions and 24 deletions

View file

@ -4,9 +4,8 @@ compiler stack
setlocal makeprg=stack\ build
setlocal keywordprg=:Hoogle
nmap <buffer> <LocalLeader>b :Neomake!<CR>
nmap <buffer> <LocalLeader>t :NeomakeSh stack exec -- hasktags -x -c .<CR>
nmap <buffer> <LocalLeader>td :NeomakeSh stack exec -- haskdogs<CR>
nmap <buffer> <LocalLeader>t :AsyncDo stack exec -- hasktags -x -c .<CR>
nmap <buffer> <LocalLeader>td :AsyncDo stack exec -- haskdogs<CR>
nmap <buffer> <LocalLeader>g :Ghcid<CR>
nmap <buffer> <LocalLeader>k :GhcidKill<CR>
nmap <buffer> <LocalLeader>c :HoogleClose<CR>

View file

@ -1,9 +1,11 @@
setlocal norelativenumber
setlocal nolist norelativenumber nowrap number nocursorline
setlocal scrolloff=0
noremap <silent><buffer> p :call quickui#tools#preview_quickfix()<CR>
noremap <buffer> [- :colder<CR>
noremap <buffer> ]+ :cnewer<CR>
nnoremap <buffer> [- :colder<CR>
nnoremap <buffer> ]+ :cnewer<CR>
nnoremap <buffer> <Leader>g :Cfilter<SPACE>
" Close QF window if it is last window
autocmd WinEnter * if winnr('$') == 1 && &buftype == "quickfix" | q | endif

View file

@ -22,3 +22,8 @@ augroup UserStatusline
autocmd ColorScheme * hi User7 guifg=Gray guibg=Black
autocmd ColorScheme * hi User8 guifg=DarkYellow guibg=Black
augroup END
augroup QfAlwaysBottom
autocmd!
autocmd FileType qf wincmd J
augroup END

View file

@ -94,5 +94,8 @@ let g:loaded_tarPlugin = 1
let g:loaded_vimballPlugin = 1
let g:loaded_zipPlugin = 1
" Add the in built Cfilter plugin. Replaces QFGrep.
packadd cfilter
" Colorscheme
colorscheme molokai

View file

@ -31,14 +31,13 @@ Plug 'vim-utils/vim-husk'
Plug 'sakhnik/nvim-gdb', { 'do': ':UpdateRemotePlugins' }
" Rainbow Parentheses
Plug 'luochen1990/rainbow'
" Neo/Async stuff
" Formatting
Plug 'sbdchd/neoformat'
Plug 'neomake/neomake'
" Run things async
Plug 'hauleth/asyncdo.vim'
" Quickfix
Plug 'sk1418/QFGrep'
Plug 'ronakg/quickr-cscope.vim'
Plug 'stefandtw/quickfix-reflector.vim'
Plug 'mhinz/vim-grepper'
Plug 'milkypostman/vim-togglelist'
Plug 'skywind3000/vim-quickui'
Plug 'yssl/QFEnter'

View file

@ -11,6 +11,9 @@ nnoremap Q <Nop>
nnoremap <Leader>o :call GotoJump()<CR>
nnoremap <Leader>; :changes<CR>:keepjumps norm g;<Left><Left>
nnoremap <Leader>, :changes<CR>:keepjumps norm g,<Left><Left>
" Async Make mappings
nnoremap <LocalLeader>b :Make<CR>
nnoremap <LocalLeader>B :LMake<CR>
" For Fuzzy
nnoremap <Leader>b :Buffers<CR>
@ -90,16 +93,6 @@ omap ih <Plug>(GitGutterTextObjectInnerPending)
omap ah <Plug>(GitGutterTextObjectOuterPending)
xmap ih <Plug>(GitGutterTextObjectInnerVisual)
xmap ah <Plug>(GitGutterTextObjectOuterVisual)
" For Neomake/Neoformat
nnoremap <Leader>nm :Neomake<CR>
nnoremap <Leader>nc :NeomakeClean<CR>
nnoremap <Leader>ns :NeomakeSh<SPACE>
nnoremap <Leader>njl :NeomakeListJobs<CR>
nnoremap <Leader>nja :NeomakeCancelJobs<CR>
nnoremap <Leader>njc :NeomakeCancelJob<SPACE>
nnoremap <Leader>nf :Neoformat<CR>
nnoremap <Leader>ne :NeomakeEnable<CR>
nnoremap <Leader>nd :NeomakeDisable<CR>
" For workspace
nnoremap <Leader>ws :ToggleWorkspace<CR>
" Quickfix & Location list mappings
@ -109,8 +102,8 @@ nnoremap [q :cprevious<CR>
nnoremap ]q :cnext<CR>
nnoremap [Q :cfirst<CR>
nnoremap ]Q :clast<CR>
nnoremap qs :Grepper -nojump -query<SPACE>
nnoremap q* :Grepper -nojump -cword<CR>
nnoremap qs :Grep<SPACE>
nnoremap q* :Grep <cword><CR>
nnoremap qt :call ToggleQuickfixList()<CR>
nnoremap Lo :lopen<CR>
nnoremap Lc :lclose<CR>
@ -118,8 +111,8 @@ nnoremap [l :lprevious<CR>
nnoremap ]l :lnext<CR>
nnoremap [L :lfirst<CR>
nnoremap ]L :llast<CR>
nnoremap Ls :Grepper -nojump -noquickfix -query<SPACE>
nnoremap L* :Grepper -nojump -noquickfix -cword<CR>
nnoremap Ls :LGrep<SPACE>
nnoremap L* :LGrep <cword><CR>
nnoremap Lt :call ToggleLocationList()<CR>
" Preview tags
nnoremap pt :ptag <C-R><C-W><CR>
@ -173,3 +166,6 @@ nnoremap <BS> <C-^>
" Map to ; to : for easy access to command mode. Behaviour of ; can be taken
" care of by f due to clever-f
nnoremap ; :
" Asynchronous make
command! -bang -nargs=* -complete=file Make call asyncdo#run(<bang>0, &makeprg, <f-args>)
command! -bang -nargs=* -complete=file LMake call asyncdo#lrun(<bang>0, &makeprg, <f-args>)

View file

@ -0,0 +1,19 @@
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