13

I am using vim 7.4. cscope output in vim is all white. can it be made more colorful?

I tried cecscope, which uses quickfix to bring color to vim. But the output of it is not small-screen friendly. it is not that useful when using a laptop.

so is there some other way to add color to cscope output? I like the ctags output in vim, or can cscope have the same style?

Alex
  • 1,737
  • 2
  • 20
  • 35
  • Did you try the `cscopetag` option as in `:help 'cscopetag'`? – romainl Feb 11 '14 at 06:45
  • first thanks for your reply. *cst* option only decides which tag database to use first, tags or cscope.out. It has no effect on the cscope output. – Alex Feb 11 '14 at 09:13
  • It has a second effect: cscope is also used (first or second) for traditional ctags-related commands. – romainl Feb 11 '14 at 11:36
  • Hmmm, I didn't notice that. I tried it. but when i want to search for calling functions, cscope comes in again. So, cscope is still a must for me, :cs f c xxx. So I think I have to look for some other way to make cscope vim output colorful. – Alex Feb 12 '14 at 02:06

5 Answers5

13

The default editor for Cscope is vi not VIM. Vi has no option for Syntax highlighting and other features of plugins etc. Just change the default editor to vim. All your Vim settings will come to Cscope output.

$ export CSCOPE_EDITOR=vim 

Done.

Anirudh
  • 210
  • 2
  • 12
  • 3
    Thank you for your solution, I tried your version and export CSCOPE_EDITOR=`which vim`. the output still is all white. no colortheme there. i don't know what i am missing here. – Alex Apr 10 '14 at 09:41
2

For me, all the above suggestions didn't work.
What I was searching for is something like this:

CScope highlight search result

I achieved it by gluing up several vim commands:

nnoremap * 
    \ :exec("cs find s ".expand("<cword>"))<CR> 
    \ :copen<CR> 

* - highlight word under cursor
:exec("cs find s ".expand("<cword>"))<CR> - cscope find word under cursor
:copen - open cscope search results window

1

Use this in .vimrc --

syntax enable

-- rather than --

syntax on

This worked for me.

0

You can set color to cscope editor by changing its default editor to vim from vi. You need to just add an environment variable CSCOPE_EDITOR as /usr/bin/vim (get your absolute path for vim using which vim command). Add the below line to your .cshrc file in your home folder to make it retain (I tried in REDHAT).

setenv CSCOPE_EDITOR /usr/bin/vim
Tom
  • 3,031
  • 1
  • 25
  • 33
0

Exporting CSCOPE_EDITOR in ~/.bashrc worked for me.

export CSCOPE_EDITOR=/usr/bin/vim

Thanks Anirudh. 'which vim' will tell which executable of vim is in use.