Ubuntu下配置Vim及插件
1、首先要安装vim,默认Ubuntu是未安装Vim的
sudo apt-get install vim
sudo apt install vim
2、为了安装pathogen插件,新建文件夹,切换到.vim下,执行git init
mkdir ~/.vim
mkdir ~/.vim/{autoload,bundle}
cd .vim
sudo apt install git
git init
Initialized empty Git repository in /home/cloudor/.vim/.git/ 表示成功
3、安装过程,先下载vim-pathogen,下载地址 https://github.com/tpope/vim-pathogen 也可以直接执行如下语句
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
然后添加下面的命令到~/.vimrc文件中,如果文件不存在,先创建它
vim ~/.vimrc
写入如下内容
execute pathogen#infect()
syntax on
filetype plugin indent on
执行语句,安装sensible.vim
cd ~/.vim/bundle
git clone git://github.com/tpope/vim-sensible.git
Cloning into 'vim-sensible'...
remote: Counting objects: 285, done.
remote: Total 285 (delta 0), reused 0 (delta 0), pack-reused 285
Receiving objects: 100% (285/285), 41.81 KiB | 48.00 KiB/s, done.
Resolving deltas: 100% (72/72), done.
Checking connectivity... done.
新插件安装到bundle目录下后,如果插件中包含doc,则需要在Vim中运行:Helptags来生成在线帮助tags
我建议依次安装和学习如下插件:vim-sensible, vim-airline, vim-abolish, ctrlp.vim, UltiSnips, vim-surround, vim-easy-align
更多Vim相关教程见以下内容: