Notes on setting up the Neovim text editor.
To install Neovim on macOS with Homebrew, run this command:
brew install neovim
To install Neovim on Fedora Linux, run this command:
sudo dnf install neovim
The EDITOR Environment Variable
Remember to set the EDITOR environment variable in your ~/.bash_profile file, so that this editor is automatically invoked by command-line tools like your version control system.
To make Neovim your default editor, use this line:
Creating A Configuration File
Once you have installed Neovim, create a file called ~/.config/nvim/init.vim. This is your configuration file for Neovim.
This command creates a init.vim file with the set number option specified:
echo 'set number' >> ~/.config/nvim/init.vim
Setting the Leader Key
Many packages use the leader key. You must specify which key that you want to use as the leader key, because this is not set by default. This directive sets the comma key as the leader:
let mapleader = ","
Neovim and Vim 8 include support for plugins, which means that you do not need to use a third-party plugin manager.
To add plugins to current versions, first create a directory for plugins:
mkdir -p ~/.local/share/nvim/site/pack/git-plugins/start
Then add these lines to your init.vim file:
" Put these lines at the very end of your vimrc file. " Load all plugins now. " Plugins need to be added to runtimepath before helptags can be generated. packloadall " Load all of the helptags now, after plugins have been loaded. " All messages and errors will be ignored. silent! helptags ALL
You can now install plugins by using Git to download them to the packages directory. For example, this command installs the ALE plugin:
git clone https://github.com/w0rp/ale.git ~/.local/share/nvim/site/pack/git-plugins/start/ale