花开的时候我们还在没等到花儿凋零

配置vim

Correct·2022-08-03 19:07·52 次阅读

配置vim

自己写vim配置属实有些复杂麻烦,并且对新手还不友好,既然github上有开源的配置好的,为什么不可以直接用呢?开整!

本文转载自github开源项目 The Ultimate Vim configuration 大家可以去star一下以表支持

  1. 安装 vim
sudo apt-get update
sudo apt install vim
  1. 安装 git
sudo apt install git
  1. 通过 git 获取 github 上的开源配置
git clone https://github.com/amix/vimrc.git
  1. 根据 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

参考
The Ultimate Vim configuration

posted @   correct  阅读(52)  评论(0编辑  收藏  举报
(评论功能已被禁用)
相关博文:
阅读排行:
· 分享一个免费、快速、无限量使用的满血 DeepSeek R1 模型,支持深度思考和联网搜索!
· 使用C#创建一个MCP客户端
· 基于 Docker 搭建 FRP 内网穿透开源项目(很简单哒)
· ollama系列1:轻松3步本地部署deepseek,普通电脑可用
· 按钮权限的设计及实现
点击右上角即可分享
微信分享提示