Those who love syntax highlighting in Linux may be a bit annoyed when they see no syntax highlighting when a file is opened in cscope. Well, this ain’t cscope’s problem. It’s just that cscope doesn’t know (or at least it doesn’t attempt to learn) that you have vim command in the system. So cscope uses standard vi command instead of vim command while opening a file. This creates trouble for user as the general features of vim listed below are not seen when the file is opened with in cscope environment.

  • Code syntax highlighting
  • Remembering last visited line of a file
  • Remembering history of last searches made in vim
  • Remembering history of commands ran in vim

Well, to solve this problem, you just need to export a variable CSCOPE_EDITOR environment variable before you run cscope. If you don’t want to do this manually every time you run cscope, you can place it in ~/.bashrc file. Place the following line at the end of you ~/.bashrc file.

export CSCOPE_EDITOR=vim

If you want another editor (may be graphical editor like gedit or kwrite), you can change the environment variable accordingly.