9

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
brokenfoot
  • 11,083
  • 10
  • 59
  • 80
  • 1
    try `EDITOR=vim cscope` – Arturo Volpe Jan 24 '15 at 02:09
  • Nope , that doesn't work. – brokenfoot Jan 24 '15 at 02:17
  • 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`. – Jonathan Leffler Jan 24 '15 at 04:11
  • vi is almost certainly vim. – romainl Jan 24 '15 at 07:22
  • 1
    Alternative: use cscope inside of vim instead of the other way around. See `:h cscope` and `:h :cscope` – Peter Rincker Jan 25 '15 at 22:04
  • 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. – brokenfoot Feb 18 '15 at 01:04
  • It seems that i have the same problem as you describe. How did you fix it? – MMMMMCCLXXVII May 30 '15 at 10:38
  • For Vim users on Windows at least (I don't know about Linux): http://stackoverflow.com/a/35024192/1245420 – phonetagger Apr 15 '16 at 14:15

1 Answers1

11

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.

Zaz
  • 46,476
  • 14
  • 84
  • 101
user3852528
  • 111
  • 1
  • 4