nvim: init.vim: Reintroduce QFGrep for cscope
Commit 6a26c59f
removed Quickfix + QFGrep enhancement for
cscope since we wanted to use fzf and later skim. However,
since we now want to have as much as possible only pure
vimscript dependencies, reintroduce this so we need not
depend on fzf or any external fuzzy search tool anymore
with our recent usage of vim-clap.
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
b3ac08c56f
commit
0a9b5e78ca
1 changed files with 48 additions and 53 deletions
101
nvim/init.vim
101
nvim/init.vim
|
@ -9,7 +9,6 @@ Plug 'ervandew/supertab'
|
|||
" of words.
|
||||
Plug 'easymotion/vim-easymotion'
|
||||
" Fuzzy search
|
||||
Plug 'junegunn/fzf.vim'
|
||||
Plug 'liuchengxu/vim-clap'
|
||||
" Remove extraneous whitespace when edit mode is exited
|
||||
Plug 'thirtythreeforty/lessspace.vim'
|
||||
|
@ -37,6 +36,8 @@ Plug 'rbong/vim-flog'
|
|||
" For tmux yank
|
||||
Plug 'vim-utils/vim-husk'
|
||||
" Tags
|
||||
Plug 'sk1418/QFGrep'
|
||||
Plug 'steffanc/cscopemaps.vim'
|
||||
Plug 'ludovicchabant/vim-gutentags'
|
||||
Plug 'deoplete-plugins/deoplete-tag'
|
||||
" GDB
|
||||
|
@ -244,6 +245,7 @@ nnoremap <Leader>ghr :GitGutterPreviewHunk<CR>
|
|||
nnoremap <Leader>gqf :GitGutterQuickFix<CR>
|
||||
nnoremap <Leader>ggf :GitGutterFold<CR>
|
||||
" For Cscope
|
||||
nnoremap <Leader>cu :NeomakeSh cscope -bqR<CR>
|
||||
nnoremap <Leader>cr :cs reset<CR>
|
||||
" For Neomake
|
||||
nnoremap <Leader>nm :Neomake<CR>
|
||||
|
@ -455,46 +457,39 @@ autocmd BufRead,BufNewFile *.md,*.txt setlocal spell spelllang=en_uk
|
|||
" Automatically resize the window
|
||||
autocmd VimResized * wincmd =
|
||||
|
||||
" CScope & fuzzy integration
|
||||
" Taken from https://gist.github.com/amitab/cd051f1ea23c588109c6cfcb7d1d5776
|
||||
" However, the above gist has completely wrong mappings
|
||||
function! Cscope(option, query)
|
||||
let color = '{ x = $1; $1 = ""; z = $3; $3 = ""; printf "\033[34m%s\033[0m:\033[31m%s\033[0m\011\033[37m%s\033[0m\n", x,z,$0; }'
|
||||
let opts = {
|
||||
\ 'source': "cscope -dL" . a:option . " " . a:query . " | awk '" . color . "'",
|
||||
\ 'options': ['--ansi', '--prompt', '> ',
|
||||
\ '--multi', '--bind', 'alt-a:select-all,alt-d:deselect-all',
|
||||
\ '--color', 'bw'],
|
||||
\ 'down': '40%'
|
||||
\ }
|
||||
function! opts.sink(lines)
|
||||
let data = split(a:lines)
|
||||
let file = split(data[0], ":")
|
||||
execute 'e ' . '+' . file[1] . ' ' . file[0]
|
||||
endfunction
|
||||
call fzf#run(opts)
|
||||
" For CScope and Quickfix
|
||||
" https://medium.com/@lakshmankumar12/quickfix-and-location-list-in-vim-ca0292ac894d
|
||||
" https://medium.com/@lakshmankumar12/vim-and-cscope-5f4558c8a8b8
|
||||
function! Cscope(oper, currword)
|
||||
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
|
||||
|
||||
function! CscopeQuery(option)
|
||||
call inputsave()
|
||||
if a:option == '9'
|
||||
let query = input('Assignments to: ')
|
||||
elseif a:option == '3'
|
||||
let query = input('Functions calling: ')
|
||||
elseif a:option == '2'
|
||||
let query = input('Functions called by: ')
|
||||
elseif a:option == '6'
|
||||
let query = input('Egrep: ')
|
||||
elseif a:option == '7'
|
||||
let query = input('File: ')
|
||||
elseif a:option == '1'
|
||||
let query = input('Definition: ')
|
||||
elseif a:option == '8'
|
||||
let query = input('Files #including: ')
|
||||
elseif a:option == '0'
|
||||
if a:option == "s"
|
||||
let query = input('C Symbol: ')
|
||||
elseif a:option == '4'
|
||||
elseif a:option == "g"
|
||||
let query = input('Definition: ')
|
||||
elseif a:option == "d"
|
||||
let query = input('Functions called by: ')
|
||||
elseif a:option == "c"
|
||||
let query = input('Functions calling: ')
|
||||
elseif a:option == "t"
|
||||
let query = input('Text: ')
|
||||
elseif a:option == "e"
|
||||
let query = input('Egrep: ')
|
||||
elseif a:option == "f"
|
||||
let query = input('File: ')
|
||||
elseif a:option == "i"
|
||||
let query = input('Files #including: ')
|
||||
elseif a:option == "a"
|
||||
let query = input('Assignments to: ')
|
||||
else
|
||||
echo "Invalid option!"
|
||||
return
|
||||
|
@ -507,25 +502,25 @@ function! CscopeQuery(option)
|
|||
endif
|
||||
endfunction
|
||||
|
||||
nnoremap <silent> <Leader>ss :call Cscope('0', expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>sg :call Cscope('1', expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>sd :call Cscope('2', expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>sc :call Cscope('3', expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>st :call Cscope('4', expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>se :call Cscope('6', expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>sf :call Cscope('7', expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>si :call Cscope('8', expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>sa :call Cscope('9', expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>ss :call Cscope("s", expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>sg :call Cscope("g", expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>sd :call Cscope("d", expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>sc :call Cscope("c", expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>st :call Cscope("t", expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>se :call Cscope("e", expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>sf :call Cscope("f", expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>si :call Cscope("i", expand('<cword>'))<CR>
|
||||
nnoremap <silent> <Leader>sa :call Cscope("a", expand('<cword>'))<CR>
|
||||
|
||||
nnoremap <silent> <Leader><Leader>ss :call CscopeQuery('0')<CR>
|
||||
nnoremap <silent> <Leader><Leader>sg :call CscopeQuery('1')<CR>
|
||||
nnoremap <silent> <Leader><Leader>sd :call CscopeQuery('2')<CR>
|
||||
nnoremap <silent> <Leader><Leader>sc :call CscopeQuery('3')<CR>
|
||||
nnoremap <silent> <Leader><Leader>st :call CscopeQuery('4')<CR>
|
||||
nnoremap <silent> <Leader><Leader>se :call CscopeQuery('6')<CR>
|
||||
nnoremap <silent> <Leader><Leader>sf :call CscopeQuery('7')<CR>
|
||||
nnoremap <silent> <Leader><Leader>si :call CscopeQuery('8')<CR>
|
||||
nnoremap <silent> <Leader><Leader>sa :call CscopeQuery('9')<CR>
|
||||
nnoremap <silent> <Leader><Leader>ss :call CscopeQuery("s")<CR>
|
||||
nnoremap <silent> <Leader><Leader>sg :call CscopeQuery("g")<CR>
|
||||
nnoremap <silent> <Leader><Leader>sd :call CscopeQuery("d")<CR>
|
||||
nnoremap <silent> <Leader><Leader>sc :call CscopeQuery("c")<CR>
|
||||
nnoremap <silent> <Leader><Leader>st :call CscopeQuery("t")<CR>
|
||||
nnoremap <silent> <Leader><Leader>se :call CscopeQuery("e")<CR>
|
||||
nnoremap <silent> <Leader><Leader>sf :call CscopeQuery("f")<CR>
|
||||
nnoremap <silent> <Leader><Leader>si :call CscopeQuery("i")<CR>
|
||||
nnoremap <silent> <Leader><Leader>sa :call CscopeQuery("a")<CR>
|
||||
|
||||
function! NvimGdbNoTKeymaps()
|
||||
tnoremap <silent> <buffer> <esc> <c-\><c-n>
|
||||
|
|
Loading…
Reference in a new issue