diff --git a/nvim/init.vim b/nvim/init.vim index 04da4db..e56952c 100644 --- a/nvim/init.vim +++ b/nvim/init.vim @@ -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 css :call LoadCscopeToQuickFix(expand(""),"s") +nnoremap csg :call LoadCscopeToQuickFix(expand(""),"g") +nnoremap csc :call LoadCscopeToQuickFix(expand(""),"c")