nvim: init.vim: Revert back to using cscope with fzf
Signed-off-by: Sanchayan Maity <maitysanchayan@gmail.com>
This commit is contained in:
parent
77f5543f45
commit
c80bb00a55
1 changed files with 64 additions and 58 deletions
|
@ -384,25 +384,25 @@ augroup c_maps
|
||||||
au FileType c nmap <Leader>cu :NeomakeSh cscope -bqR<CR>
|
au FileType c nmap <Leader>cu :NeomakeSh cscope -bqR<CR>
|
||||||
au FileType c nmap <Leader>cr :cs reset<CR>
|
au FileType c nmap <Leader>cr :cs reset<CR>
|
||||||
|
|
||||||
au FileType c nmap <silent> <Leader>ss :call Cscope("s", expand('<cword>'))<CR>
|
au FileType c nmap <silent> <Leader>ss :call Cscope('0', expand('<cword>'))<CR>
|
||||||
au FileType c nmap <silent> <Leader>sg :call Cscope("g", expand('<cword>'))<CR>
|
au FileType c nmap <silent> <Leader>sg :call Cscope('1', expand('<cword>'))<CR>
|
||||||
au FileType c nmap <silent> <Leader>sd :call Cscope("d", expand('<cword>'))<CR>
|
au FileType c nmap <silent> <Leader>sd :call Cscope('2', expand('<cword>'))<CR>
|
||||||
au FileType c nmap <silent> <Leader>sc :call Cscope("c", expand('<cword>'))<CR>
|
au FileType c nmap <silent> <Leader>sc :call Cscope('3', expand('<cword>'))<CR>
|
||||||
au FileType c nmap <silent> <Leader>st :call Cscope("t", expand('<cword>'))<CR>
|
au FileType c nmap <silent> <Leader>st :call Cscope('4', expand('<cword>'))<CR>
|
||||||
au FileType c nmap <silent> <Leader>se :call Cscope("e", expand('<cword>'))<CR>
|
au FileType c nmap <silent> <Leader>se :call Cscope('6', expand('<cword>'))<CR>
|
||||||
au FileType c nmap <silent> <Leader>sf :call Cscope("f", expand('<cword>'))<CR>
|
au FileType c nmap <silent> <Leader>sf :call Cscope('7', expand('<cword>'))<CR>
|
||||||
au FileType c nmap <silent> <Leader>si :call Cscope("i", expand('<cword>'))<CR>
|
au FileType c nmap <silent> <Leader>si :call Cscope('8', expand('<cword>'))<CR>
|
||||||
au FileType c nmap <silent> <Leader>sa :call Cscope("a", expand('<cword>'))<CR>
|
au FileType c nmap <silent> <Leader>sa :call Cscope('9', expand('<cword>'))<CR>
|
||||||
|
|
||||||
au FileType c nmap <silent> <Leader><Leader>ss :call CscopeQuery("s")<CR>
|
au FileType c nmap <silent> <Leader><Leader>ss :call CscopeQuery('0')<CR>
|
||||||
au FileType c nmap <silent> <Leader><Leader>sg :call CscopeQuery("g")<CR>
|
au FileType c nmap <silent> <Leader><Leader>sg :call CscopeQuery('1')<CR>
|
||||||
au FileType c nmap <silent> <Leader><Leader>sd :call CscopeQuery("d")<CR>
|
au FileType c nmap <silent> <Leader><Leader>sd :call CscopeQuery('2')<CR>
|
||||||
au FileType c nmap <silent> <Leader><Leader>sc :call CscopeQuery("c")<CR>
|
au FileType c nmap <silent> <Leader><Leader>sc :call CscopeQuery('3')<CR>
|
||||||
au FileType c nmap <silent> <Leader><Leader>st :call CscopeQuery("t")<CR>
|
au FileType c nmap <silent> <Leader><Leader>st :call CscopeQuery('4')<CR>
|
||||||
au FileType c nmap <silent> <Leader><Leader>se :call CscopeQuery("e")<CR>
|
au FileType c nmap <silent> <Leader><Leader>se :call CscopeQuery('6')<CR>
|
||||||
au FileType c nmap <silent> <Leader><Leader>sf :call CscopeQuery("f")<CR>
|
au FileType c nmap <silent> <Leader><Leader>sf :call CscopeQuery('7')<CR>
|
||||||
au FileType c nmap <silent> <Leader><Leader>si :call CscopeQuery("i")<CR>
|
au FileType c nmap <silent> <Leader><Leader>si :call CscopeQuery('8')<CR>
|
||||||
au FileType c nmap <silent> <Leader><Leader>sa :call CscopeQuery("a")<CR>
|
au FileType c nmap <silent> <Leader><Leader>sa :call CscopeQuery('9')<CR>
|
||||||
augroup END
|
augroup END
|
||||||
|
|
||||||
augroup rust_maps
|
augroup rust_maps
|
||||||
|
@ -650,39 +650,45 @@ let g:netrw_liststyle = 3
|
||||||
let g:netrw_browse_split = 4
|
let g:netrw_browse_split = 4
|
||||||
let g:netrw_altv = 1
|
let g:netrw_altv = 1
|
||||||
let g:netrw_winsize = 10
|
let g:netrw_winsize = 10
|
||||||
|
|
||||||
" ----------------------------- Functions ------------------------------------
|
" ----------------------------- Functions ------------------------------------
|
||||||
" For CScope and Quickfix
|
function! Cscope(option, query)
|
||||||
" https://medium.com/@lakshmankumar12/quickfix-and-location-list-in-vim-ca0292ac894d
|
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; }'
|
||||||
" https://medium.com/@lakshmankumar12/vim-and-cscope-5f4558c8a8b8
|
let opts = {
|
||||||
function! Cscope(oper, currword)
|
\ 'source': "cscope -dL" . a:option . " " . a:query . " | awk '" . color . "'",
|
||||||
execute "normal mZ"
|
\ 'options': ['--ansi', '--prompt', '> ',
|
||||||
execute "set csqf=" . a:oper . "-"
|
\ '--multi', '--bind', 'alt-a:select-all,alt-d:deselect-all',
|
||||||
execute "lcs find " a:oper . " " . a:currword
|
\ '--color', 'info:144,prompt:161,spinner:135,pointer:135,marker:118',
|
||||||
execute "lopen"
|
\ '--color', 'fg:252,bg:233,hl:67,fg+:252,bg+:235,hl+:81'],
|
||||||
execute "wincmd p"
|
\ 'down': '40%'
|
||||||
execute "normal `Z"
|
\ }
|
||||||
execute "set csqf="
|
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)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! CscopeQuery(option)
|
function! CscopeQuery(option)
|
||||||
call inputsave()
|
call inputsave()
|
||||||
if a:option == "s"
|
if a:option == '0'
|
||||||
let query = input('C Symbol: ')
|
let query = input('C Symbol: ')
|
||||||
elseif a:option == "g"
|
elseif a:option == '1'
|
||||||
let query = input('Definition: ')
|
let query = input('Definition: ')
|
||||||
elseif a:option == "d"
|
elseif a:option == '2'
|
||||||
let query = input('Functions called by: ')
|
let query = input('Functions called by: ')
|
||||||
elseif a:option == "c"
|
elseif a:option == '3'
|
||||||
let query = input('Functions calling: ')
|
let query = input('Functions calling: ')
|
||||||
elseif a:option == "t"
|
elseif a:option == '4'
|
||||||
let query = input('Text: ')
|
let query = input('Text: ')
|
||||||
elseif a:option == "e"
|
elseif a:option == '6'
|
||||||
let query = input('Egrep: ')
|
let query = input('Egrep: ')
|
||||||
elseif a:option == "f"
|
elseif a:option == '7'
|
||||||
let query = input('File: ')
|
let query = input('File: ')
|
||||||
elseif a:option == "i"
|
elseif a:option == '8'
|
||||||
let query = input('Files #including: ')
|
let query = input('Files #including: ')
|
||||||
elseif a:option == "a"
|
elseif a:option == '9'
|
||||||
let query = input('Assignments to: ')
|
let query = input('Assignments to: ')
|
||||||
else
|
else
|
||||||
echo "Invalid option!"
|
echo "Invalid option!"
|
||||||
|
|
Loading…
Reference in a new issue