Loading ...
Sorry, an error occurred while loading the content.

How to set -P argument for the cscope being run by the vim6.3

Expand Messages
  • Natesh Kedlaya
    Hi, I have added following lines to my .vimrc if has( cscope ) set csprg=/usr/local/bin/cscope set csto=0 set cst set nocsverb add any database in current
    Message 1 of 3 , May 2 9:05 AM
    • 0 Attachment
      Hi,
      I have added following lines to my .vimrc

      if has("cscope")
      set csprg=/usr/local/bin/cscope
      set csto=0
      set cst
      set nocsverb
      " add any database in current directory
      if filereadable("cscope.out")
      cs add cscope.out
      " else add database pointed to by environment
      elseif $CSCOPE_DB != ""
      cs add $CSCOPE_DB
      endif
      set csverb
      endif

      I have set the CSCOPE_DB to '/myuser/mydir/cscope/cscope.out'.
      When I open a 'C' source file, I could see the cscope connections starting as shown below:

      # pid database name prepend path
      0 22089 /myuser/mydir/cscope/cscope.out <none>

      As one can see from the output, the "prepend path" is set to <none>.
      How do I set the "prepend path" to some value that I want?

      I am able to use -P argument of cscope outside the vim to get the intended results but, not in the vim.

      I am using the Vim 6.3.

      Please help.

      Thanks,
      Natesh





      __________________________________________________
      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam protection around
      http://mail.yahoo.com
    • Natesh Kedlaya
      Thank you Taylor. Your suggestion worked. I had to make two changes though. 1. unset the env parameter CSCOPE_DB 2. Add an extra condition to handle the
      Message 2 of 3 , May 2 4:25 PM
      • 0 Attachment
        Thank you Taylor.

        Your suggestion worked. I had to make two changes though.

        1. unset the env parameter CSCOPE_DB
        2. Add an extra condition to handle the non-existing CSCOPE_DB env as
        elseif $CSCOPE_DB = ""
        cs add /my/path/cscope.out my/prepend/path
        endif

        For some reason if the CSCOPE_DB env is set the prepend path stuff does not work.

        Thanks,
        Natesh

        ----- Original Message ----
        From: Taylor Venable <taylor@...>
        To: Natesh Kedlaya <nateshkedlaya@...>
        Cc: vim@...
        Sent: Wednesday, May 2, 2007 10:40:28 AM
        Subject: Re: How to set -P argument for the cscope being run by the vim6.3

        On Wed, 2 May 2007 09:05:38 -0700 (PDT)
        Natesh Kedlaya <nateshkedlaya@...> wrote:

        > As one can see from the output, the "prepend path" is set to <none>.
        > How do I set the "prepend path" to some value that I want?
        >
        > I am able to use -P argument of cscope outside the vim to get the
        > intended results but, not in the vim.
        >
        > I am using the Vim 6.3.

        I'm not sure about Vim 6.3 - but in Vim 7.0 you can pass another
        argument to ":cscope add" which sets the prepend path. So for example:

        :cscope add /path/to/database/cscope.out /home/username

        This sets /home/username as the prepend path, as if you had done -P on
        the command line.

        (Upon further inspection, I don't see anything in version7.txt about
        this being new in Vim 7.0 so it should work (I would imagine) in the
        version of Vim you're running.)

        --
        Taylor Venable
        taylor@...
        http://www.metasyntax.net/




        __________________________________________________
        Do You Yahoo!?
        Tired of spam? Yahoo! Mail has the best spam protection around
        http://mail.yahoo.com
      Your message has been successfully submitted and would be delivered to recipients shortly.