How to set vim as default cscope editor?
Asked Answered
G

1

10

cscope opens my files in vi. Is there a way to change it so that it opens files in vim instead ?

Edit: I tried:

export CSCOPE_EDITOR=vim

For some weird reason, if I type :help on the file opened, it shows vim help which indicates it is opened in vim but it doesn't seem to read my .vimrc. How can I make it read my .vimrc ?

Edit 2: Machine/tool info

[user@machine] $  printenv | grep -i cscope    
CSCOPE_EDITOR=vim

[user@machine] $  vim --version
VIM - Vi IMproved 7.0 (2006 May 7, compiled Jul 10 2012 08:48:09)
Included patches: 1, 3-4, 7-9, 11, 13-17, 19-26, 29-31, 34-44, 47, 50-56, 58-64, 66-73, 75, 77-92, 94-107, 109, 202, 234-237

[user@machine] $  cscope -V
cscope: version 15.5
Glasses answered 24/1, 2015 at 1:57 Comment(8)
try EDITOR=vim cscopeGorgoneion
Nope , that doesn't work.Glasses
I have both EDITOR=vim and VISUAL=vim set in my environment, and cscope uses vim and runs with my setup. However, unsetting either or both also leaves it running vim, so that's not conclusive. Looking at the strings in the program, EDITOR appears but VISUAL does not; there is also CSCOPE_EDITOR. All of which is not much help. Did you build cscope? Which version are you running (-V; I'm running 15.7a that I built on a Mac)? I do have EXINIT set, but vim is being run with settings that are not in EXINIT.Flavine
vi is almost certainly vim.Holland
Alternative: use cscope inside of vim instead of the other way around. See :h cscope and :h :cscopeArty
It is working now, but I still don't know what the problem was. For some weird reason, my files were getting opened in vim, but it wasn't reading my old .vimrc. I tried deleting the cscope.out file and re-creating it and then opening the search results, they were still opening in vim but the .vimrc wasn't still being read. In a new workspace, I tried the whole thing again and now cscope files do open up in vim, .vimrc being properly read.Glasses
It seems that i have the same problem as you describe. How did you fix it?Malatya
For Vim users on Windows at least (I don't know about Linux): https://mcmap.net/q/870438/-how-to-bring-color-to-cscope-output-in-vimEumenides
G
13

Just make sure that your .vimrc is at the same location as .bashrc. And then in .bashrc, add the following line:

export CSCOPE_EDITOR=vim

This worked for me.

Gargoyle answered 9/8, 2016 at 5:42 Comment(1)
Explanation of what this does and why it works would be good.Homogenous

© 2022 - 2024 — McMap. All rights reserved.