惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

T
Tailwind CSS Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
雷峰网
雷峰网
量子位
有赞技术团队
有赞技术团队
阮一峰的网络日志
阮一峰的网络日志
The Cloudflare Blog
博客园 - Franky
罗磊的独立博客
宝玉的分享
宝玉的分享
博客园_首页
腾讯CDC
The GitHub Blog
The GitHub Blog
D
DataBreaches.Net
IT之家
IT之家
D
Docker
Microsoft Security Blog
Microsoft Security Blog
博客园 - 司徒正美
V
V2EX
月光博客
月光博客
N
Netflix TechBlog - Medium
爱范儿
爱范儿
I
InfoQ
P
Proofpoint News Feed

jdhao's digital space

Conversion between base64 and OpenCV or PIL Image 腾讯云对象存储博客图床开启 CDN 加速(不需要购买额外域名) Search and Replace in Multiple Files in Vim/Neovim Change Table Column Width in LaTeX Image or Table Side by Side in LaTeX LaTeX 并排显示图像或表格 Firenvim: Neovim inside Your Browser Content inside HTML tags missing in Latest Hugo? Creating Markdown Front Matter with Ultisnips Labelme JSON 标注格式转 voc XML 格式 Nifty Nvim Techniques That Make My Life Easier -- Series 6 macOS 下如何为视频制作字幕 Running Command Asynchronously inside Neovim Resolving Merge Conflict after Git Stash Pop Pylint: command not found? A Hands-on Experience with Neovim's Built-in LSP Support How to Convert PDF to Images with Imagemagick 互联网上常用缩略语集锦 File Backup in Neovim Converting PDF Pages to Images with Poppler Nifty Nvim Techniques That Make My Life Easier -- Series 5 How to sort a list of tuple or list in Python -- lambda or itemgetter? Building A Vim Statusline from Scratch 人类第一颗原子弹爆炸始末 Distributed Training in PyTorch with Horovod Learning Expect Programming Essential Knowledge about SSH Nifty LaTeX Techniques -- Series 1 更改 Adsense 邮寄地址,重新寄送 PIN Mintty Tips and Configurations
Neovim Configuration for System-wide Use
2019-11-10 · via jdhao's digital space

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 summarize the necessary configurations.

Installation#

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 Neovim:

export PATH=/etc/nvim-linux64/bin:PATH

Global configuration#

According to the documentation of Neovim, Neovim will look for nvim/sysinit.vim under $XDG_CONFIG_DIRS (the default is /etc/xdg)1.

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 --depth 1 https://github.com/jdhao/nvim-config.git .

We also need to create a symlink sysinit.vim and link it to init.vim:

ln -s init.vim sysinit.vim

Change the value of g:nvim_system_wide in 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 here). Now, as root user, open neovim and use :PlugInstall to install plugins.

The system configuration is finished.

Personal configuration#

Usually, each user may want to change the default configuration set by the root. 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 runtimepath. For example, if we install ayu-vim under /home/jdhao/.local/share/nvim/plugged/ayu-vim, we should add the following setting to $HOME/.config/nvim/init.vim:

set runtimepath+=/home/jdhao/.local/share/nvim/plugged/ayu-vim

Another way of adding your personal plugins to runtimepath is by using vim-plug:

Plug '~/.local/share/nvim/plugged/ayu-vim'

You have to manually update the plugin though.

References#