[vim] plugin for cscope in python
This commit is contained in:
parent
292f741bb1
commit
1de0397c71
@ -1,4 +1,4 @@
|
||||
" This script is a wrapper for ctags and cscope, so tags for all languages
|
||||
" autotags plugin: a wrapper for ctags and cscope, so tags for all languages
|
||||
" supported by ctags can be build (cscope is additionally used for C/C++).
|
||||
" Tags are stored in a separate directory and don't clog you project tree
|
||||
|
||||
@ -183,6 +183,12 @@ fun! s:AutotagsInit()
|
||||
let g:autotags_cscope_exe = "cscope"
|
||||
endif
|
||||
|
||||
if !exists("g:autotags_pycscope_cmd")
|
||||
let g:autotags_pycscope_pyt = "/soft/Python-2.7.3.i686/bin/python"
|
||||
let g:autotags_pycscope_scr = "~/.vim/plugin/pycscope.py"
|
||||
let g:autotags_pycscope_cmd = g:autotags_pycscope_pyt . " " . g:autotags_pycscope_scr
|
||||
endif
|
||||
|
||||
if !exists("g:autotags_cscope_file_extensions")
|
||||
let g:autotags_cscope_file_extensions = ".cpp .cc .cxx .m .hpp .hh .h .hxx .c .idl .java"
|
||||
endif
|
||||
@ -344,6 +350,16 @@ fun! s:AutotagsGenerate(sourcedir, tagsdir)
|
||||
\ "nice -15 " . g:autotags_cscope_exe . " -b -q -k")
|
||||
endif
|
||||
endif
|
||||
echomsg system("cd " . shellescape(l:cscopedir) . " && " .
|
||||
\ " nice -15 find " . shellescape(a:sourcedir) .
|
||||
\ " -not -regex '.*/\\..*' " .
|
||||
\ " -not -regex '.*/\\%.*' " .
|
||||
\ " -name '*.py' " .
|
||||
\ " -fprint cscope_py.files")
|
||||
if getfsize(l:cscopedir . "/cscope_py.files") > 0
|
||||
echomsg system("cd " . shellescape(l:cscopedir) . " && " .
|
||||
\ "nice -15 " . g:autotags_pycscope_cmd . " -i cscope_py.files -f cscope_py.out" )
|
||||
endif
|
||||
endfun
|
||||
|
||||
fun! s:AutotagsReload(tagsdir)
|
||||
@ -381,6 +397,11 @@ fun! s:AutotagsLoad(tagsdir)
|
||||
if filereadable(l:cscopedb)
|
||||
exe "cs add " . l:cscopedb
|
||||
endif
|
||||
|
||||
let l:cscopepydb = a:tagsdir . "/cscope_py.out"
|
||||
if filereadable(l:cscopepydb)
|
||||
exe "cs add " . l:cscopepydb
|
||||
endif
|
||||
endfun
|
||||
|
||||
fun! s:AutotagsIsLoaded()
|
||||
|
@ -1,5 +1,5 @@
|
||||
"
|
||||
" cscope (a tool to browse through C source files ) keymaping
|
||||
" cscope keymaping plugin
|
||||
" (a tool to browse through C source files)
|
||||
"
|
||||
|
||||
" if compiled with --enable-cscope
|
||||
@ -9,6 +9,19 @@ if has("cscope")
|
||||
endif
|
||||
let g:loaded_cscope = 1.0
|
||||
|
||||
function! GoToDefinition()
|
||||
try
|
||||
execute "cscope find g " . expand("<cword>")
|
||||
catch /:E259:/
|
||||
try
|
||||
execute "tag " . expand("<cword>")
|
||||
catch /:E257:/
|
||||
execute "normal! gd"
|
||||
execute "nohlsearch"
|
||||
endtry
|
||||
endtry
|
||||
endfunction
|
||||
|
||||
" use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t'
|
||||
set cscopetag
|
||||
" use ctags before cscope
|
||||
@ -34,7 +47,8 @@ if has("cscope")
|
||||
nmap <F5> :cscope find s <C-R>=expand("<cword>")<CR><CR>
|
||||
nmap <S-F5> :scscope find s <C-R>=expand("<cword>")<CR><CR>
|
||||
" go to definition with F6 and split with shift+F6 and use ctags with alt+shift+F6
|
||||
nmap <F6> :cscope find g <C-R>=expand("<cword>")<CR><CR>
|
||||
"nmap <F6> :cscope find g <C-R>=expand("<cword>")<CR><CR>
|
||||
nmap <F6> :call GoToDefinition()<CR>
|
||||
nmap <S-F6> :scscope find g <C-R>=expand("<cword>")<CR><CR>
|
||||
nmap <M-S-F6> :tag <C-R>=expand("<cword>")<CR><CR>
|
||||
" go to calls with F7 and split with shift+F7
|
||||
|
Loading…
Reference in New Issue
Block a user