I have been using Neovim for personal projects for over a year. Recently, I want to set up Neovim system wide so that other users in the server can also use my config if they want. In this post, I will describe the necessary configurations.
First, you need to install Neovim in a system location, for example, under
/opt. Then edit the system profile
/etc/profile and add the path of
According to the documentation of Neovim, Neovim will look for
$XDG_CONFIG_DIRS (the default is
So for global configuration, we need to put all configuration under
/etc/xdg/nvim. Take my configuration for an example:
mkdir /etc/xdg/nvim && cd /etc/xdg/nvim && git clone https://github.com/jdhao/nvim-config.git .
We also need to create a symlink
sysninit.vim and link it to
ln -s init.vim sysinit.vim
Change the value of
init.vim to 1 to
install the plugins system-wide.
Since I use vim-plug to manage plugins, I have set up vim-plug to install the
system wide plugin under
/usr/local/share/nvim/site (see code
Now, as root user, open neovim and use
:PlugInstall to install plugins.
The system configuration is finished.
Ususally, each user may want to change the default configuration set by the
root users. The user's personal config should be put in
$HOME/.config/nvim/init.vim. It will override the global configurations.
There is currently one gotcha: the users can not install local plugins using
vim-plug easily. If the user want to install a custom plugin, they should first
clone the plugin repo to a location and add the plugin path to
For example, if we install
/home/jdhao/.local/share/nvim/plugged/ayu-vim, we should add the
following setting to
Another way of adding your personal plugins to runtimepath is by using vim-plug:
You have to manually update the plugin though.
- Neovim doc,
- Neovim doc,
- system wide nvim config.
See neovim documentation
:h sysinit.vim. ↩︎
License CC BY-NC-ND 4.0