I would like to share with you a new tool, which was written over the weekend: bxr.
This tool implements a subset of the functionalities of mxr.mozilla.org using a local database and it can be used as a standalone application or combined with vim.
This is how I use it:
$ cd ~/Sources/m/central # this is a checkout of mozilla-central $ bxr create .
With this command, bxr indexes the source tree and creates the database (.bxr.db). This operation should be done each time the tree is updated. It takes about 25 minutes.
Then, for searching, just type:
$ bxr identify nsIDOMFile Result for: nsIDOMFile File: ./content/base/public/nsDOMFile.h Line: 37 -> class nsDOMFileBase : public nsIDOMFile, File: ./ipc/glue/InputStreamUtils.cpp Line: 14 -> #include "nsIDOMFile.h" ....
At the moment BXR can be used to:
- identify, to search for the definitions of particular functions, variables, etc.
- search, to search in the source code.
- file, to find files whose name matches a pattern
I love working with this tool alongside vim using a plugin. This allows me to do:
:BI nsIDOMFile :BF ArchiveReader :BS ArchiveReader::V
This app is just an experiment. I am still working on it. What I want to do is to reduce the size of the database (right now 800~Mb are required for indexing mozilla-central…). I hope to have something stable and usable soon!