引言
以neovim的安装过程为例
下载
curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
sudo rm -rf /opt/nvim
sudo tar -C /opt -xzf nvim-linux64.tar.gz
添加环境变量前,是无法使用man nvim
的
Then add this to your shell config (~/.bashrc, ~/.zshrc, …):
export PATH="$PATH:/opt/nvim-linux64/bin"
通过man man
命令,得知man的配置文件为/etc/manpath.config
通过查看可以发现一段
# *PATH* -> *MANPATH*
#
MANPATH_MAP /bin /usr/share/man
MANPATH_MAP /usr/bin /usr/share/man
MANPATH_MAP /sbin /usr/share/man
MANPATH_MAP /usr/sbin /usr/share/man
MANPATH_MAP /usr/local/bin /usr/local/man
MANPATH_MAP /usr/local/bin /usr/local/share/man
MANPATH_MAP /usr/local/sbin /usr/local/man
MANPATH_MAP /usr/local/sbin /usr/local/share/man
MANPATH_MAP /usr/X11R6/bin /usr/X11R6/man
MANPATH_MAP /usr/bin/X11 /usr/X11R6/man
MANPATH_MAP /usr/games /usr/share/man
MANPATH_MAP /opt/bin /opt/man
MANPATH_MAP /opt/sbin /opt/man
可问题是/opt/下是没有直接的bin目录的,所以可以推测出该配置使得man命令识别了添加了的环境变量/opt/xxx/bin下的/opt/xxx/man下的man文件