-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvimrc
More file actions
228 lines (170 loc) · 5.42 KB
/
vimrc
File metadata and controls
228 lines (170 loc) · 5.42 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
set nocompatible "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 'gmarik/Vundle.vim'
" minibufexpl
Plugin 'vim-scripts/minibufexpl.vim'
""Plugin 'vim-scripts/The-NERD-tree'
" Pydiction python补全插件
""Plugin 'vim-scripts/Pydiction'
""Plugin 'vim-scripts/python.vim'
" SnipMate
""Plugin 'vim-scripts/snipMate'
" Python 提示插件
""Plugin 'davidhalter/jedi-vim'
" 显示缩进
"Plugin 'vim-scripts/Indent-Guides'
Plugin 'Yggdroot/indentLine'
"二者只需要使用一个就可以了
Plugin 'vim-scripts/AutoComplPop'
""Plugin 'Shougo/neocomplete.vim'
""Plugin 'vim-scripts/Syntastic'
"Plugin 'vim-scripts/SuperTab'
" a.vim
"Plugin 'vim-scripts/a.vim' "不可
"多行注释
"Plugin 'vim-scripts/The-NERD-Commenter'
Plugin 'molokai'
"All of your Plugins must be added before the following line
call vundle#end() " required
filetype plugin indent on " requiredcall vundle
" Brief help
" :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
"
" see :h vundle for more details or wiki for FAQ
"""" end of vundle
"""""""""""""""""""""""
"基本配置
"""""""""""""""""""""""
" macbookpro下没 backspace,使用delete删除
fixdel
syntax enable
syntax on "语法高亮,关键字高亮
" 解决有时乱码问题
set fileencoding=utf8
set fileencodings=utf-8,gb18030,utf-16,big5
"设置当前文件路径为vim的路径
set autochdir
set number "显示行号
set mouse=a "使用鼠标
" 使用>> << 时的宽度为4
set shiftwidth=4
" tab的宽度设置成4
set tabstop=4
" backspace可以直接删除4个空格
set softtabstop=4
set expandtab
" allow backspacing over everything in insert mode
set backspace=indent,eol,start
"对齐相关
set autoindent
""set smartindent
""set cindent
" 命令行显示输入的命令
set showcmd
" 命令行显示vim当前模式
set showmode
set cursorline
set history=500
"禁止生成备份和临时文件
set nobackup
set noswapfile
"当文件被改动时自动载入
set autoread
"自动保存
set autowrite
"启用折叠,手动折叠
set foldenable
set foldmethod=manual
"去掉错误时的声音
set noeb
"高亮搜索
set hlsearch incsearch
"搜索时大小写不敏感
set ignorecase
"在处理未保存或只读文件的时候,弹出确认"
set confirm
"显示状态栏
set ruler
set laststatus=2
"设置字体
set guifont=Monaco:h14
""""""""""""""""""""""""""""""""""""""""""""""""""""
" 为了更加方便使用的配置
"Set mapleader
let mapleader=","
"Fast reloading of the .vimrc
map <silent> <leader>ss :source ~/.vimrc<CR>
""Fast editing of .vimrc
map <silent> <leader>ee :e ~/.vimrc<CR>
"When .vimrc is edited,reload it
autocmd! bufwritepost .vimrc source ~/.vimrc"
" buffer 相关操作
nnoremap <silent> [b :bprevious<CR>
nnoremap <silent> ]b :bnext<CR>
"将选中文本块复制到系统剪贴板
vnoremap <leader>y "+y
"将系统剪贴板内容粘贴到vim
nmap <leader>p "+p"
" 自动补全( [ { " '
inoremap ( ()<ESC>i
inoremap [ []<ESC>i
inoremap { {}<ESC>i
inoremap " ""<ESC>i
inoremap ' ''<ESC>i
""""""""""""""""""""""""""""""""""""""""""""""
" colorscheme
""""""""""""""""""""""""""""""""""""""""""""""
colorscheme darkblue
"""""""""""""""""""""""""""""""""""""""""""""""
" minibufexpl
" """""""""""""""""""""""""""""""""""""""""""""
let g:miniBufExplUseSingleClick=1 " 单击切换
let g:miniBufExplMapWindowNavVim=1 "使用 ctrl+hjkl切换窗口
let g:miniBufExplMapWindowNavArrows=1 "使用 ctrl+方向箭切换窗口
""""""""""""""""""""""""""""""""""""""""""""""
" Syntastic
""""""""""""""""""""""""""""""""""""""""""""""
" :SyntasticInfo 查看相关信息
" :SyntasticToggleMode 开关
""set statusline+=%#warningmsg#
""set statusline+=%{SyntasticStatuslineFlag()}
""set statusline+=%*
""let g:syntastic_always_populate_loc_list = 1
""let g:syntastic_auto_loc_list = 1
""let g:syntastic_check_on_open = 0
""let g:syntastic_check_on_wq = 0
""""""""""""""""""""""""""""""""""""""""""""""
" Pydiction
""""""""""""""""""""""""""""""""""""""""""""""
"TAB 显示提示
"<Space> -- Accept current match and insert a space.
"CTRL-Y -- Accept current match and and don't insert a space.
"<Enter> -- Accept current match and insert a newline.
"<ESC> or CTRL-E -- Close the menu and do not accept any match.
""let g:pydiction_location = '/Users/dai/.vim/bundle/Pydiction/complete-dict'
""""""""""""""""""""""""""""""""""""""""""
"SuperTab
""""""""""""""""""""""""""""""""""""""""""
"let g:SuperTabDefaultCompletionType = "<c-x><c-u>" "默认为<C-p>
"""""""""""""""""""""""""""""""""""""""""""
" 创建python文件时自动加上
""autocmd! BufNewFile *.py exec ":call AddPythonHead()"
""function! AddPythonHead()
"" call setline(1,"#! /usr/bin/python")
"" call append(1,"# -*- coding:utf-8 -*-")
""endfunction
"""""""""""""""""""""""""""""""""""""""""""
" jedi插件
""let g:jedi#goto_assignments_command = "<leader>g"
""let g:jedi#goto_definitions_command = "<leader>d"
""let g:jedi#documentation_command = "K"
""let g:jedi#usages_command = "<leader>n"
""let g:jedi#completions_command = "<C-/>"
""let g:jedi#rename_command = "<leader>r"