Fork me on GitHub

Getting Started

Once you’ve installed eclim, the next step is to create your first project after which you can then start writing code and familiarizing yourself with eclim’s features.

First make sure eclimd is running (see the eclimd docs if you are unsure how to start eclimd).

Creating your first project

Once you’ve got eclimd running, open an instance of vim and create your project like so:

:ProjectCreate /path/to/my_project -n java

This example creates a project with a java nature (-n java), but the same method can be used to create a project for other languages by simply changing the nature accordingly:

:ProjectCreate /path/to/my_java_project -n java
:ProjectCreate /path/to/my_python_project -n python

The path supplied to the :ProjectCreate command will be the path to the root of your project. This path may or may not exist. If it does not exist it will be created for you. After you’ve created your project, there will be a .project file added to your project’s root along with another file where references to your project’s source directories and any third party libraries your project uses reside. The name of this file will vary depending on your project’s nature, but in all cases eclim will provide you with commands to manage this file:

Once you’ve created your project you can use the :ProjectList command to list the available projects and you should see your newly created one in the list.

my_project - open   - /path/to/my_project

The :ProjectList result is in the form of projectName - (open|closed) - /project/root/path. When you create projects, the last path element will be used for the project name. If that element contains any spaces, these will be converted to underscores.

Adding project source directories

Before you can start writing code, you will first need to create and register your project’s source directories. If you created your project from an existing code base, then this step may have been perform automatically for you, but you should validate the settings to be sure.

We will use a java project in this example but the steps for other languages are very similar. Please see the relevant docs for your language for more details:

For the purpose of this example we will assume that you will store your source files at:


So, given that location, you will need to open the file /path/to/my_project/.classpath in Vim.

vim /path/to/my_project/.classpath

To add the source directory simply execute the following

:NewSrcEntry src/java

This will add the necessary entry to the end of your .classpath file. The contents of this file should now look something like this:

<?xml version="1.0" encoding="UTF-8"?>
  <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
  <classpathentry kind="output" path="bin"/>
  <classpathentry kind="src" path="src/java"/>

Now that your source directory is setup, you can proceed to edit java files in that directory and make use of the java functionality provided by eclim.

Writing code in your new project

Now that you have a project created, you can start writing code and utilize the features that eclim provides.


Below we’ll walk through a trivial java example, but some of the steps apply to all the languages that eclim supports, although the command names may differ a bit. For additional docs on working with the language of your choice, please see the relevant section of the docs:

Lets get started writing our first java application using eclim.

  1. First, navigate to your new project’s source directory (src/java in this example) and create any necessary package directories:

    $ cd /path/to/my_project/src/java
    $ mkdir -p org/test/
  2. Then start editing your first java source file:

    $ vim org/test/
    package org.test;
    public class TestMain
      public static final void main(String[] args)
  3. You can start to use some of the core features now. For example, lets add the following code to the main method so we can test eclim’s source code validation:


    Then save the file and note that an error marker is placed in the left margin of your file and when the cursor is on that line an error message is printed at the bottom of your vim window. You can also run :lopen to view all the errors in the file at once.

  4. Now lets try out code completion. Place your cursor on the ‘.’ of ‘System.’ and start insert mode in vim using ‘a’, then follow the example below:

    System.<ctrl-x><ctrl-u>             // starts the completion mode
    System.<ctrl-n>                     // cycle through the completion suggestions
    System.out                          // assuming you chose the 'out' suggestion
    System.out.p<ctrl-x><ctrl-u>        // now start completion again
    System.out.p<ctrl-n>                // hit <ctrl-n> until you get 'println'
    System.out.println("Hello World");  // finish up the example code.
  5. After saving the file you should have no more validation errors, so now we can run the code like so:


    After running the :Java command in vim you should now see your output in a new split window.

This only scratches the surface on the number of java features that eclim provides, but hopefully this example was enough to get you started.

Maven Users

Creating your first project with maven can be accomplished using the same method as any other java project, or you can utilize some of maven’s built in features to get your project started.

  1. Run maven’s generate archetype to create the project directory and samples:

    $ mvn archetype:generate
  2. Once you’ve created the initial project directory, cd into that directory and run the following command to generate the necessary eclipse files:

    $ cd <project_dir>
    $ mvn eclipse:eclipse
  3. Now you can start an instance of vim at the project’s root directory and run the following commands to:

    • set the necessary eclipse classpath variable to point to your maven repository.
    • import your new project into eclipse.
    $ vim
    :ProjectImport /path/to/new/project