A community-driven vim distribution

Home | About | Quick start guide | Documentation | Development | Community | Sponsors

Blogs » Use Vim as a Java IDE

This tutorial introduces you to SpaceVim as a Java environment, by using the lang#java layer, you make SpaceVim into a great lightweight Java IDE.

Each of the following sections will be covered:

This tutorial is not intended to teach you Java itself.

If you have any problems, feel free to join the SpaceVim gitter chatting room for general discussion.

Enable language layer

lang#java layer is not loaded by default in SpaceVim, to use SpaceVim for java, you need to enable this layer in SpaceVim configuration file. Press SPC f v d to open SpaceVim configuration file, and add following section:

  name = "lang#java"

Language server

To enable language server protocol support, you may need to enable lsp layer.

  name = "lsp"
  filetypes = [
    java = [

You need to replace D:\dev\jdt-language-server-latest\plugins\org.eclipse.equinox.launcher_1.5.200.v20180922-1751.jar with the actual name of the org.eclipse.equinox.launcher jar

The configuration flag can point to either:

The data flag value should be the absolute path to the working directory of the server. This should be different from the path of the user’s project files (which is sent during the initialize handshake).

Code completion

javacomplete2 which has been included in lang#java layer provides omnifunc for java file and deoplete source. with this plugin and autocomplete layer, the completion popup menu will be opened automatically.

code complete

Code outline

The default outline plugin is tagbar, and the key binding is F2. This key binding will open an outline sidebar on the left.

java outline

To fuzzy find outline in current buffer, you need to enable a fuzzy find layer, for example denite layer, then press Leader f o:

java fuzzy outline

Rename symbol

To rename java symbol, you need to enable lsp layer for java. The default key binding for rename symbol under the cursor is SPC l e.