您的位置:首页 > 其它

vim 插件管理器-Vundle

2016-11-15 23:40 441 查看
Vim除了基本的使用方法,还有非常丰富的插件。如果没有管理器,插件的安装,更新,删除将会非常麻烦,个人感觉作用就类似RPM/yum, deb/apt-get,可以自行体会。  

Vundle托管在G’itHub上,项目地址:https://github.com/VundleVim/Vundle.vim/  

项目中的README.md有Vundle的基本介绍和安装及使用方法。

 

使用Vundle的好处:

- 在.vimrc中配置和管理plug-in

- 在vim中安装,更新,查找plug-in

重点说一下如何添加新的插件,在.vimrc的Vundle配置中有说明,可以使用如下四种方式添加需要的plug-in,前两种比较常用,主意查看每种插件在使用Vundle管理时在.vimrc中的配置(如一下第一种方式中的配色plug-in):

plugin on GitHub repo

Plugin 'flazz/vim-colorschemes


plugin from http://vim-scripts.org/vim/scripts.html

Plugin 'L9'


Git plugin not hosted on GitHub

Plugin 'git://git.wincent.com/command-t.git'


git repos on your local machine (i.e. when working on your own plugin)

Plugin 'file:///home/gmarik/path/to/plugin'


Quick Start

贴出我自己的.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'

" 来自github

"主题
Plugin 'flazz/vim-colorschemes'

"底部状态栏
Plugin 'Lokaltog/vim-powerline'

"文件目录
Plugin 'scrooloose/nerdtree'

"快速查找
Plugin 'kien/ctrlp.vim'

"快速注释
Plugin 'scrooloose/nerdcommenter'

"自动补全
Plugin 'Shougo/neocomplcache.vim'

" 来自vim

" non github repos

call vundle#end()            " required

" ==============================================================================
filetype plugin indent on    " required
" To ignore plugin indent changes, instead use:
"filetype plugin on

" ==============================================================================
" vundle命令
" :PluginList       - lists configured plugins
" :PluginInstall    - installs plugins; append `!` to update or just :PluginUpdate
" :PluginSearch foo - searches for foo; append `!` to refresh local cache
" :PluginClean      - confirms removal of unused plugins; append `!` to auto-approve removal

" ==============================================================================
" 组件设置
" flazz/vim-colorschemes,主题设置
colorscheme  molokai

"NERDTree 插件配置
map <F3> :NERDTreeToggle<CR>
autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) | q | endif
let NERDTreeShowHidden = 1 "NERDTREE显示隐藏文件
" ==============================================================================
" vim原生设置
" set rnu "显示相对行号
set nu
syntax on " 打开语法检测

set tabstop=2 "设置tab键长度
set sw=2
set ts=2

set list "设置空格显示为+号
set listchars=trail:+

set foldmethod=syntax "代码折叠
set foldlevelstart=99 "默认不折叠

set cursorline  "设置光标行
set noswapfile "不要生成swap文件
set nobackup
set bufhidden=hide "当buffer被丢弃的时候隐藏它
set guicursor=n-v-c:hor10 "normal下贯标显示为下划线
set expandtab                 "Use space instead of tabs

let mapleader = ","  "设置外部复制粘帖
let g:mapleader = ","
map Y "+y
map P "+p

"noremap ok o<esc> "插入新行

" Change cursor shape between insert and normal mode in iTerm2.app
if $TERM_PROGRAM =~ "iTerm.app"
let &t_SI = "\<Esc>]50;CursorShape=1\x7" " Vertical bar in insert mode
let &t_EI = "\<Esc>]50;CursorShape=0\x7" " Block in normal mode
endif

"neocomplcache.vim
let g:neocomplcache_enable_at_startup = 1 "打开vim时自动打开
let g:neocomplcache_force_overwrite_completefunc = 1
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: