nvim: init.vim: Improve CScope with Quickfix and QFGrep

This commit is contained in:
Sanchayan Maity 2019-10-30 14:59:21 +05:30 committed by Sanchayan Maity
parent 494e99fcbd
commit 6a26c59f1f

View file

@ -41,6 +41,7 @@ Plug 'vim-utils/vim-husk'
" Tags
Plug 'steffanc/cscopemaps.vim'
Plug 'ludovicchabant/vim-gutentags'
Plug 'sk1418/QFGrep'
" GDB
Plug 'sakhnik/nvim-gdb', { 'do': ':UpdateRemotePlugins' }
" Lisp
@ -357,3 +358,20 @@ autocmd BufRead,BufNewFile */gstreamer-*/*.[ch] set et sw=2
autocmd BufRead,BufNewFile */pulseaudio/*.[ch] set et sw=4 tw=128
" Spell Checking
autocmd BufRead,BufNewFile *.md,*.txt setlocal spell spelllang=en_uk
" For CScope and Quickfix
" https://medium.com/@lakshmankumar12/quickfix-and-location-list-in-vim-ca0292ac894d
" https://medium.com/@lakshmankumar12/vim-and-cscope-5f4558c8a8b8
function! LoadCscopeToQuickFix(currword, oper)
execute "normal mZ"
execute "set csqf=" . a:oper . "-"
execute "lcs find " a:oper . " " . a:currword
execute "lopen"
execute "wincmd p"
execute "normal `Z"
execute "set csqf="
endfunction
nnoremap <Leader>css <Esc>:call LoadCscopeToQuickFix(expand("<cword>"),"s")<CR>
nnoremap <Leader>csg <Esc>:call LoadCscopeToQuickFix(expand("<cword>"),"g")<CR>
nnoremap <Leader>csc <Esc>:call LoadCscopeToQuickFix(expand("<cword>"),"c")<CR>