Fork me on GitHub

Type Creation

Creating a new Class, Interface, etc.

:JavaNew is a command that allows you to create new classes, interfaces, enums, or annotations by specifying which of those you’d like to create, followed by the fully qualified path of the new type.

The available types you can create include:

  • class - a new class
  • interface - a new interface
  • abstract - a new abstract class
  • enum - a new enum
  • @interface - a new annotation

Here are some examples:

:JavaNew class org.test.MyNewClass
:JavaNew interface org.test.MyNewInterface

If you ommit the package name, the new type will be created in the same package as the file you are currently editing:

:JavaNew class MyNewClass


This command supports command completion of the available types (class, interface, etc) as well as completion of existing package names.

In the case where the source directory to create the type in is ambiguous, you will be prompted to choose the source directory from a list.