pycscope with Vim

September 28th, 2010 at 10:05 am

I’ve written earlier about some problems I was having with the cscope tool for browsing Python code in Vim. Well, it turns out I was using an older version of pycscope for some reason, and the latest version actually does play well with cscope.

Interestingly, cscope wasn’t really designed to support languages other than C. I’ve had an interesting email exchange with one of its maintainers, and I think the following quote from him is conclusive:

The program’s name is "cscope" for a reason. It’s not called c++scope, not javacscope, not pythoncsope, and certainly not "every programming language under the sun"scope.

Asked about the database format of cscope, he said that it’s not documented by design, to make sure all tools go through cscope itself. Fair enough, I guess.

The author of pycscope, however, perused the code of cscope (open source FTW!) to understand the DB format and generate a compatible cscope.out file from his script, which made it possible to use the integration of cscope in Vim after all.

That said, I’m still not sure whether cscope is more convenient for Python than EasyGrep – I need more time to decide.

Related posts:

  1. Browsing Python source code with Vim
  2. Fearing the “second system effect” in my rewrite of ESMS

2 Responses to “pycscope with Vim”

  1. Steven MuellerNo Gravatar Says:

    Have you looked at GNU Global? http://www.gnu.org/software/global/

    It’s similar to cscope, but uses a different database format and has a plugin system for supporting additional languages. Two interface mechanisms are provided for Vim: ctags-style and cscope style (the latter supports the Vim tag stack).

    A quick Google search turned up this python plugin for global:
    http://code.google.com/p/python-global-tags/

    (I haven’t tried the Python global plugin or pycscope yet, so I don’t know how they compare.)

  2. RubenNo Gravatar Says:

    Hi Eli,

    If you like pycscope, you may find this interesting.

    I just improved my code browsing/ searching tool to make use of pycscope, and therefore adding Python to my tool, CodeQuery.

    Please check it out here: https://github.com/ruben2020/codequery

Leave a Reply

To post code with preserved formatting, enclose it in `backticks` (even multiple lines)