diff --git a/.vim/plugin/cscope.vim b/.vim/plugin/cscope.vim index f851a6c..a80ed9c 100644 --- a/.vim/plugin/cscope.vim +++ b/.vim/plugin/cscope.vim @@ -5,27 +5,25 @@ " if compiled with --enable-cscope if has("cscope") if exists("g:loaded_cscope") || &cp - finish + finish endif let g:loaded_cscope = 1.0 function! GoToDefinition() try - execute "cscope find g " . expand("") - catch /:E259:/ - try - execute "tag " . expand("") - catch /:E257:/ - execute "normal! gd" - execute "nohlsearch" - endtry + execute "tag " . expand("") + catch /:E257:/ + execute "normal! gd" + execute "nohlsearch" endtry endfunction + nmap , :call GoToDefinition() + nmap ; " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t' set cscopetag " use ctags before cscope - set csto=0 + set csto=1 " add any cscope database in current directory if filereadable("cscope.out") cscope add cscope.out diff --git a/.vimrc b/.vimrc index 0a5fb06..25fe329 100644 --- a/.vimrc +++ b/.vimrc @@ -219,21 +219,6 @@ set mat=5 " go to declaration with F5 " map gd:nohlsearch " imap i -" try to go to definition or declaration with , and go back with ; -function GoToDefinition() - try - execute "cscope find g " . expand("") - catch /:E259:/ - try - execute "tag " . expand("") - catch /:E257:/ - execute "normal! gd" - execute "nohlsearch" - endtry - endtry -endfunction -nmap , :call GoToDefinition() -nmap ; " plugin taglist let Tlist_Ctags_Cmd = '/usr/bin/ctags'