一般ubuntu都会默认安装vim-tiny版本
1 vim插件
在用户主目录下的 ~/.vimrc 文件中完成的,如果没有的话,需要自己新建一下:
cd ~
touch .vimrc
touch是在linux中比较常用的创建文件命令, 关于touch和mkdir的区别请自行百度
vim插件中最主要的就是vundle了,vundle用来管理vim的其它插件
项目地址https://github.com/VundleVim/Vundle.vim。
首先下载源码:
git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
如果~/.vim/bundle目录不存在,则新建目录:
cd ~
mkdir .vim
cd .vim
mkdir bundle
然后将下列配置放在.vimrc文件的开头:
set nocompatible " be iMproved, required
filetype off " required
" set the runtime path to include Vundle and initialize
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " required
如果想下载某个插件,比如自动缩进indentpython.vim插件,需要将
Plugin 'vim-scripts/indentpython.vim'
置于call vundle#begin()和call vundle#end()之间,保存配置后在vim中执行,输入linux命令vim,回车,然后输入:
:PluginInstall
即可以自动下载indentpython.vim插件了。
bundle可以管理下载几种不同的插件,方式如下:
github上的插件
Plugin 'tpope/vim-fugitive'
来自于http://vim-scripts.org/vim/scripts.html的插件
Plugin 'L9'
非github上的git插件
Plugin 'git://git.wincent.com/command-t.git'
本地插件
Plugin 'file:///home/gmarik/path/to/plugin'
" The sparkup vim script is in a subdirectory of this repo called vim.
" Pass the path to set the runtimepath properly.
" Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
有旧插件的情况下,下载新的插件并重命名以避免冲突
Plugin 'ascenator/L9', {'name': 'newL9'}
下载方式除了在vim中运行:PluginInstall外,还可以在命令行中运行:
vim +PluginInstall +qall
这部分也可参考以下链接:
https://www.cnblogs.com/linxiyue/p/7834817.html
2 简单设置.vimrc