[ACCEPTED]-vim cannot connect to cscope database-cscope
This is mentioned in the comments above, but 5 I want to make sure it's preserved in an 4 answer.
The issue that came up for me was 3 that vim didn't know where to look for the 2 cscope database. When I added
cs add $CSCOPE_DB
.vimrc. Everything 1 came out fine.
I figure since I've made the visit, I would 9 try responding.
I was getting this error 8 when searching using ctrl-space s (or any 7 search for that matter):
E567: no cscope 6 connections
I finally found the full solution 5 at http://cscope.sourceforge.net/cscope_vim_tutorial.html, Step 11.
The idea is that you create 4 a list of source files to be included in 3 the view of cscope, generate the cscope.out 2 in the same location, and update the export 1 path accordingly:
find /my/project/dir -name '*.c' -o -name '*.h' > /foo/cscope.files
cscope -R -b(this may take a while depending on the size of your source)
export CSCOPE_DB=/foo/cscope.out(put this in your .bashrc/.zshrc/other-starting-script if you don't want to repeat this every time you log into the terminal)
You need to add a "cscope connection", like 1 this in vim:
:cscope add $PATH_TO_CSCOPE.out
:help cs for more examples.
Here's how I explore linux kernel source 7 using cscope:
I use vim as my editor.
- While standing inside the kernel source root directory, run
cscopein interactive mode while recursively going through subdirectories during search for source files:
When 6 run for the first time, it will generate 5 the database file with the name:
cscope.out inside 4 the current directory. Any subsequent runs 3 will use the already generated database.
- Search for anything or any file and open it.
- Set cscope tags in vim to make the
CTRL-]commands search through cscope first and then ctags' tags:
- Set cscope database inside current VIM session:
:cs add cscope.out
Now 2 you can use
CTRL-t as you would do in ctags 1 to navigate around! :)
I have the same issue on my PC. For now, to 2 solve the issue:
On terminal execute:
which is cscope
Open 1 .vimrc file to edit:
I ran into a similar problem with no cscope 8 connections on ubuntu 18.04, then I discovered 7 my .vimrc file does not load the CSCOPE_DB 6 variable. Looked a little around and found 5 a solution.
You can just copy this directly in to 4 your .vimrc file.
Part of the code loads 3 your cscope file from your directory. The 2 keybinds are just a nice bonus. Hope this 1 helps.
More Related questions