Expand All
Welcome to Nova!
Projects
Editor
Terminals
Previews
Git
Tasks
Debugging
Remote Files
Extensions
Appendix: Settings
FAQs
Support

Using Nova's CLI

Open projects from scripts or terminals with Nova's CLI tool.

Nova includes a command line tool allowing you to open files or projects in Nova from your shell. This can be useful for writing scripts that open Nova, or for simply opening a file right from a terminal.

Installation

To install this tool, go to Nova’s Settings > Tools and choose Install under the Command Line Tool header. This will install the nova executable on your Mac in /usr/local/bin.

Nova's Tools settings, showing that the command line tool has been installed.
Nova's Tools settings, showing that the command line tool has been installed.

Basic Usage

Once installed, you can invoke the CLI using the nova command. Simply running nova will open Nova as normal.

You can also use nova to open files or projects by simply passing their path as an argument, in the format nova <path>. For instance,

panic@my-mac ~ % nova ~/example.html

This command will open ~/example.html in Nova.

panic@my-mac ~ % nova ~/example-folder

This command will open ~/example-folder as a project.

NOTE: You can also use nova open <path> to perform the same actions.

If you attempt to open a file which belongs to a project that is already opened, Nova should automatically open the file in the existing workspace for that project.

If you attempt to open a file that does not already exist, Nova will open an empty editor at the specified file path. The file will be created once you save the new document.

Arguments

When opening files or projects, additional arguments can be passed. Note that the short form and long form of each argument is interchangeable, and does not affect the behavior of the argument.

-w, --wait

This argument makes the nova process continue running until the file is closed in Nova. This can be useful when writing shell scripts to ensure the script does not proceed to the next command until the file has been closed.

When using nova in commands with pipes or filters, Nova will wait for files to be closed by default. In these cases, --no-wait can be passed to prevent nova from waiting until files are closed before exiting.


-t, --type

Force the editor to open a file with a specific syntax mode. You can specify the type as either a file extension or syntax name. For example,

panic@my-mac ~ % nova ~/example.html -t js

This command will force Nova to open example.html as if it were a .js file, meaning it will use the JavaScript syntax mode.

panic@my-mac ~ % nova ~/example.html --type javascript

This command will have the same behavior, using the full syntax name instead of a file extension.


-l, --line

Open a file to a specific line. This argument also accepts a column, and a range to select when the file is opened. For example, the following commands will open ~/example.html…

panic@my-mac ~ % nova ~/example.html -l 18

… with the cursor on line 18.

panic@my-mac ~ % nova ~/example.html --line 18:5

… with the cursor at line 18, column 5.

panic@my-mac ~ % nova ~/example.html -l "18:5-18:10"

… with line 18, columns 5 through 10 selected.

panic@my-mac ~ % nova ~/example.html --line "18:5-18:10&22:3-22:16"

… with two selections:


--recent, --no-recent

Use these arguments to determine whether the file you’re opening is added to Nova’s File > Open Recent menu. By default, files will be added to the recents menu unless any of the following are true:


-a

If you have multiple versions of Nova installed on your Mac, you can use -a to open files with the specified copy of Nova. For instance,

panic@my-mac ~ % nova ~/example.html -a "/Users/panic/Downloads/Nova 11.7.app"

… will open ~/example.html using the copy of Nova 11.7 found in the ~/Downloads folder.

Extension Development

The Nova CLI can also be used when developing Nova extensions, for validating extensions and submitting them to the Extension Library. You can find more info in Creating Extensions.