0

I am not sure if this question has already been asked, but I tried my best to search for a solution.

This is the problem I am facing:

I am using both ctags and cscope for browsing c++ code. I want to use ctags listed tags inside vim and cscope outside vim (to search for symbols and text). If I search for a symbol in cscope and open the file (in vim), the other vim sessions start using tags from cscope's connection (and not of ctags' listing). I don't like cscope's listed tags because they are much more than what ctags list for me. Moreover, I feel what ctags list are more relevant to me. Currently, I terminate the cscope connection and that works. But I will have to do it every time a new vim session is opened.

How to I avoid cscope connection being used to list tags in the existing vim sessions ?

1 Answers1

0

Cscope connections are added by vim based on the following setting in vimrc (_vimrc for gVim) configuration file

cs add cscope.out

Removing this setting will prevent adding cscope connection when a vim session is opened, which should solve your issue.

For example, my vimrc file has the following block (copied from the cscope.vim in Ref[2])

if has("cscope")
    """"""""""""" Standard cscope/vim boilerplate
    " use both cscope and ctag for 'ctrl-]', ':ta', and 'vim -t'
    set cscopetag
    " check cscope for definition of a symbol before checking ctags: set to 1
    " if you want the reverse search order.
    set csto=0
    " add any cscope database in current directory
    if filereadable("cscope.out")
        cs add cscope.out
    " else add the database pointed to by environment variable 
    elseif $CSCOPE_DB != ""
        cs add $CSCOPE_DB
    endif
    " show msg when any other cscope db added
    set cscopeverbose
endif

Note: If you want to still keep the cscope search but give first preference to ctags in search, you can use this setting in your vimrc.

set csto=1

References:

http://vimdoc.sourceforge.net/htmldoc/if_cscop.html

http://cscope.sourceforge.net/cscope_maps.vim