To start vim with an empty buffer, simply type:
nvim
To open an existing file in Vim, simply add the path to the file:
nvim [path/to/file]
You can also include multiple files, to open them all at once:
nvim [path/to/file/one] [path/to/file/two] ...
Neovim also supports "globbing", which allows you to open multiple files by specifying a simple pattern. For example, to open all python files located in the current directory, simply type:
nvim *.py
In additional to opening files, Neovim supports a variety of options to control how it starts and which features are enabled. While these may not be used on a daily basis, it is good to know that they exist and how to find them.
List some of the common options from the terminal with the command:
nvim --help
or visit the Neovim docs for the complete list.
To start with options, specify one or more options when the nvim
command is invoked. For example,
use the -R
option to open a file in read-only mode:
nvim -R [path/to/tile]
Finally, as a terminal program Neovim can be called from command-line scripts to implement some types of powerful workflows. For example, suppose you want to edit the current directory listing you could execute:
ls -a | vim -
this command lists the current directory (ls -a
), then pipes (|
) the result to Vim which is
listening on stdin (-
). While this example is a bit contrived, this demonstrates a simple way to
leverage a wide range of command-line tools to get content into Vim.