1
0
mirror of https://github.com/SpaceVim/SpaceVim.git synced 2025-03-25 11:12:22 +08:00
2021-08-22 14:35:22 +08:00

67 lines
3.2 KiB
VimL

"=============================================================================
" cscope.vim --- SpaceVim cscope layer
" Copyright (c) 2016-2020 Wang Shidong & Contributors
" Author: Wang Shidong < wsdjeg at 163.com >
" URL: https://spacevim.org
" License: GPLv3
"=============================================================================
function! SpaceVim#layers#cscope#plugins() abort
let plugins = [
\ [g:_spacevim_root_dir . 'bundle/cscope.vim', {'merged' : 0}],
\ ]
return plugins
endfunction
function! SpaceVim#layers#cscope#config() abort
let g:_spacevim_mappings_space.m.c = {'name' : '+cscope'}
call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'c'], 'call cscope#find("d", expand("<cword>"))', 'find-functions-called-by-this-function', 1)
call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'C'], 'call cscope#find("c", expand("<cword>"))', 'find-functions-calling-this-function', 1)
call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'd'], 'call cscope#find("g", expand("<cword>"))', 'find-global-definition-of-a-symbol', 1)
call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'r'], 'call cscope#find("s", expand("<cword>"))', 'find-references-of-a-symbol', 1)
call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'f'], 'call cscope#find("f", expand("<cword>"))', 'find-files', 1)
call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'F'], 'call cscope#find("i", expand("<cword>"))', 'find-files-including-this-file', 1)
call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'e'], 'call cscope#find("e", expand("<cword>"))', 'Find-this-egrep-pattern', 1)
call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 't'], 'call cscope#find("t", expand("<cword>"))', 'find-this-text-string', 1)
call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', '='], 'call cscope#find("a", expand("<cword>"))', 'find-assignments-to-this-symbol', 1)
call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'u'], 'call cscope#update_databeses()', 'create-cscope-index', 1)
call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'i'], 'call cscope#create_databeses()', 'create-cscope-databases', 1)
call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'l'], 'call cscope#list_databases()', 'list-cscope-databases', 1)
call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'm'], 'call cscope#clear_databases(SpaceVim#plugins#projectmanager#current_root())', 'remove-current-cscope-databases', 1)
call SpaceVim#mapping#space#def('nnoremap', ['m', 'c', 'M'], 'call cscope#clear_databases()', 'remove-all-cscope-databases', 1)
endfunction
function! SpaceVim#layers#cscope#health() abort
call SpaceVim#layers#cscope#plugins()
call SpaceVim#layers#cscope#config()
return 1
endfunction
function! SpaceVim#layers#cscope#set_variable(var) abort
let g:cscope_cmd = get(a:var,
\ 'cscope_command',
\ 'cscope')
let g:cscope_auto_update = get(a:var,
\ 'auto_update',
\ 1)
let g:cscope_open_location = get(a:var,
\ 'open_location',
\ 1)
let g:cscope_preload_path = get(a:var,
\ 'preload_path',
\ '')
endfunction
function! SpaceVim#layers#cscope#get_options() abort
return ['cscope_command',
\ 'auto_update',
\ 'open_location',
\ 'preload_path']
endfunction