自己写vim配置属实有些复杂麻烦,并且对新手还不友好,既然github上有开源的配置好的,为什么不可以直接用呢?开整!
本文转载自github开源项目 The Ultimate Vim configuration 大家可以去star一下以表支持
- 安装 vim
sudo apt-get update
sudo apt install vim
- 安装 git
sudo apt install git
- 通过 git 获取 github 上的开源配置
git clone https://github.com/amix/vimrc.git
- 根据 github 上的文档进行配置即可
为个人用户安装配置
git clone --depth=1 https://github.com/amix/vimrc.git ~/.vim_runtime
sh ~/.vim_runtime/install_awesome_vimrc.sh
为多用户安装
git clone --depth=1 https://github.com/amix/vimrc.git /opt/vim_runtime
# 为指定用户user0 user1 user2安装
sh ~/.vim_runtime/install_awesome_parameterized.sh /opt/vim_runtime user0 user1 user2
# 为/home/目录下的所有用户安装
sh ~/.vim_runtime/install_awesome_parameterized.sh /opt/vim_runtime --all
为root安装
git clone --depth=1 https://github.com/amix/vimrc.git /opt/vim_runtime
在 root 用户的家目录下新建文件 .vimrc
将以下内容复制进去即可
" DO NOT EDIT THIS FILE
" Add your own customizations in /opt/vim_runtime/my_configs.vim
set runtimepath+=/opt/vim_runtime
source /opt/vim_runtime/vimrcs/basic.vim
source /opt/vim_runtime/vimrcs/filetypes.vim
source /opt/vim_runtime/vimrcs/plugins_config.vim
source /opt/vim_runtime/vimrcs/extended.vim
try
source /opt/vim_runtime/my_configs.vim
catch
endtry
或者 如果你已经为其他用户安装完成,例如 我的用户为 solo
可以将 solo 用户家目录下的 .vimrc 文件直接复制到 root 用户家目录下
cp /home/solo/.vimrc /root/.vimrc
或者
touch /root/.vimrc
cat /home/solo/.vimrc > /root/.vimrc