0

I want to open a .c file , that I found using cscope, in vim editor. Normally it opens in vi editor. I have made and edited vimrc file using a configuration that I found online but it isn't working. Can anyone recommend a a proper configuration for vimrc? Is there any other way to do it?

Also I am working on my office system, so I am not the super user.

0

cscope uses the environment variable EDITOR for editing files. If this environment variable is unset, it uses vi.

To set EDITOR to vim, put the following in you shell initialisation file for interactive shells ($HOME/.bashrc for bash users):

export EDITOR=vim

You may alternatively use CSCOPE_EDITOR instead of EDITOR (if you don't want to set EDITOR, which may be used by any number of other programs, including the shell, for example). The CSCOPE_EDITOR environment variable overrides the EDITOR setting.

This is mentioned in the cscope manual in the section "ENVIRONMENT VARIABLES".

  • Hi, I deed as you told but the issue still persists. I tried both CSCPOE_EDITOR and EDITOR . – kaushik chatterjee Jul 19 '18 at 8:27
  • @kaushikchatterjee Note the spelling of CSCOPE_EDITOR . These has to be set in the current shell session. Just adding them to ~/.bashrc will not do anything until you start a new shell. – Kusalananda Jul 19 '18 at 8:29
  • 1
    Yes its working now. My spelling was right. Once a I edited the ~/.bashrc file in bash , I opened a new terminal and from there I was running cscope . That was the mistake. Now, I continued within the same bash and its working now. Thanks. – kaushik chatterjee Jul 19 '18 at 8:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.