Installation

Download vimproject.zip and unzip it. Save the script somewhere convenient like /usr/local/lib.

Create vimproject.xml in the top-level directory for each project. vimproject.py looks for the XML file in the current directory, so put this file in the directory at the top of your project's tree. Don't forget vimproject will save you typing the full file name to open each file in your project, so it doesn't matter if the actual files are a long way down.

A simple vimproject.xml file looks like this:

<?xml version="1.0" encoding="iso-8859-1"?>

<project title="some project">
  <glob pattern="*.xml"/>

  <branch name="Source">
    <glob pattern="src/main/java/com/babblemind/*.java"/>
  </branch>

  <branch name="Meta">
    <glob pattern="src/META-INF/*"/>
  </branch>
</project>

The title isn't important -- at the moment vimproject doesn't do anything with it.

The interesting parts are the branch tags. Each of these will create a sub-menu on vim's Project menu. There will be an entry on the sub menu for each file matching the pattern.

It's that simple. You can have as many branch entries as you like, each will have its own sub-menu and file list. Each branch can have nested branches to create nested sub-menus. Just don't get too carried away.

There can also be a glob entry at the top which will create file items on the top-level menu. That's a useful place to put the vimproject.xml file itself, the "ant" build file, Makefile etc. If you prefer to put those files in their own sub-menu, just create branch for them.

Here is a more complex example with more sub-menus:

<?xml version="1.0" encoding="iso-8859-1"?>

<project title="ViennaSQL">
  <branch name="Admin">
    <glob pattern="*.xml"/>
    <glob pattern="src/META-INF/*"/>
  </branch>

  <branch name="Models">
    <glob pattern="src/uk/co/whisperingwind/Model/*.java"/>
  </branch>

  <branch name="Views">
    <glob pattern="src/uk/co/whisperingwind/View/*.java"/>
  </branch>

  <branch name="Controllers">
    <glob pattern="src/uk/co/whisperingwind/Controller/*.java"/>
  </branch>
</project>

You can see from this example that each branch can have more than one glob so each sub-menu can list files of many types. I used that in this file to put all the admin XML files and the project's meta file in the same sub-menu.

You can also see from this example that the sub-menus don't have to mirror the file system hierarchy which is probably a good thing with deep trees that result from properly naming Java classes.

Multiple globs could be used to group files of similar types:

<branch name="HTML">
  <glob pattern="html/*.html"/>
  <glob pattern="html/*.cgi"/>
</branch>

vimproject is free software. Comments and suggestions are welcome, but don't expect me to turn it into a full-blown IDE. There are already too many of those out there and I have better things to do than to make yet another one.

What I would like to do is put the file list in a separate window. But I can't work out how to do that without modifying vim, something I definately don't want to have to do as it would make the script less useful to others. If anyone out there has any ideas on how to do this, please let me know.