How to bring color to cscope output in vim?
Asked Answered
C

6

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?

Cohbath answered 11/2, 2014 at 2:4 Comment(4)
Did you try the cscopetag option as in :help 'cscopetag'?Musicianship
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.Cohbath
It has a second effect: cscope is also used (first or second) for traditional ctags-related commands.Musicianship
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.Cohbath
T
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.

Theobald answered 10/4, 2014 at 2:10 Comment(1)
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.Cohbath
G
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

Gluey answered 21/2, 2018 at 12:41 Comment(0)
C
1

Use this in .vimrc --

syntax enable

-- rather than --

syntax on

This worked for me.

Castellatus answered 26/1, 2016 at 21:20 Comment(0)
N
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
Newlywed answered 28/11, 2014 at 9:59 Comment(0)
L
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.

Lott answered 2/2, 2016 at 10:42 Comment(0)
M
0

The file names in the cscope output in my vim 7.4 is with white color, when my terminal is white, I can't see the file names at all. If I use a gray background color, the files names in the cscope output is visible but hard to read.

I found two options to solve the problem for me:

  1. Change to a darken colorscheme, such as :colorscheme darkblue, we can also put it in ~/.vimrc

  2. If you are using iTerm2, go to iTerm2 -> Setting -> Profiles, in your existing profile or create a new profile, select Colors, then choose a different color next to Bold, by default it's white.

Mandibular answered 29/9, 2023 at 19:1 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.