文章

Vundle管理vim插件

Vundle管理vim插件

使用Vundle管理安装vim插件

$ git clone https://github.com/gmarik/Vundle.vim.git ~/.vim/bundle/Vundle.vim

再在vimrc加类似如下配置:

1
2
3
4
5
6
7
8
9
10
11
12
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

Plugin 'gmarik/vundle'
Plugin 'tpope/vim-fugitive'
Plugin 'Lokaltog/vim-easymotion'
.
# 此处放置你需要安装的插件
.

call vundle#end()
filetype plugin indent on     " required!

然随意打开一个vim窗口

1
2
$ vim
:PluginInstall

我的vimrc:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
if has('gui_running')
  " set background=light
  set background=dark
else
  set background=dark
endif
let g:solarized_termcolors=256
set tabstop=2
set shiftwidth=2
set laststatus=2
" set dictionary+=$HOME/.mydict
" set dictionary+=/usr/share/dict/words
set isk+=- "把-分割的单词视为一个整体
" set mouse=nv
set encoding=utf-8 fileencodings=ucs-bom,utf-8,cp936
set autoindent
set cindent
set sw=2
set ts=2
set expandtab
set number                     " 行号
syntax on                      " 语法高亮
syntax enable

autocmd FileType php setlocal tabstop=4 shiftwidth=4 softtabstop=4 textwidth=79

nnoremap < v<
nnoremap > v>
vnoremap < <gv
vnoremap > >gv

let mapleader = ","
map <F3> :%s/\s*$//g<CR>:noh<CR>   "移除行尾空格
nmap <F2> :NERDTreeToggle <CR>
nmap ff :NERDTreeFind <CR>
nmap gb :Gblame <CR>
imap zsj <c-r>=strftime("%F %T")<CR>
"set cursorline "高亮光标所在行
let Tlist_Use_Right_Window=1 "方法列表放在屏幕的右侧

set list
set listchars=tab:,.,trail:.,extends:#,nbsp:.
let g:vim_markdown_folding_disabled=1

set guifont=Monaco:h15
set nocompatible               " be iMproved
filetype off                   " required!
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()

" let Vundle manage Vundle
" " required!
Plugin 'gmarik/Vundle.vim'

" My Plugins here:
"
" original repos on github
Plugin 'tpope/vim-fugitive'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'rstacruz/sparkup', {'rtp': 'vim/'}
Plugin 'tpope/vim-rails.git'

Plugin 'L9'
Plugin 'FuzzyFinder'
Plugin 'kien/ctrlp.vim'
" Plugin 'vim-scripts/snipMate'
Plugin 'mattn/emmet-vim'
Plugin 'scrooloose/nerdtree'
Plugin 'groenewege/vim-less'
Plugin 'kchmck/vim-coffee-script'
Plugin 'slim-template/vim-slim'
Plugin 'yaymukund/vim-rabl'
Plugin 'godlygeek/tabular'
Plugin 'plasticboy/vim-markdown'
Plugin 'eikenberry/acp'
Plugin 'airblade/vim-gitgutter'
Plugin 'honza/vim-snippets'
Plugin 'altercation/vim-colors-solarized'

call vundle#end()
filetype plugin indent on     " required!

colorscheme solarized
"
" Brief help
" :PluginList          - list configured bundles
" :PluginInstall(!)    - install(update) bundles
" :PluginSearch(!) foo - search(or refresh cache first) for foo
" :PluginClean(!)      - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Plugin command are not allowed..
本文由作者按照 CC BY 4.0 进行授权