@@ -8,6 +8,7 @@ set tabstop=4
8
8
set shiftwidth = 4
9
9
set expandtab
10
10
set cindent
11
+ set mps += <:>
11
12
12
13
" 代码折叠
13
14
set fdm = marker
40
41
" set cursorline
41
42
" 语法高亮度显示
42
43
let python_highlight_all= 1
44
+ let go_highlight_all= 1
43
45
syntax on
44
46
45
47
" 显示括号配对情况
@@ -48,14 +50,14 @@ filetype off " required!
48
50
49
51
set completeopt = longest,menu
50
52
51
- " bundle setting
53
+ " bundle setting
52
54
" git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle
53
55
" aptitude install vim-gui-common
54
56
set rtp += ~/.vim/bundle/vundle/
55
57
call vundle#begin ()
56
58
57
59
" let Vundle manage Vundle
58
- " required!
60
+ " required!
59
61
Bundle ' gmarik/vundle'
60
62
" 状态栏
61
63
Bundle ' vim-airline/vim-airline'
@@ -82,14 +84,17 @@ Bundle 'jiangmiao/auto-pairs'
82
84
Bundle ' vim-scripts/OmniCppComplete'
83
85
84
86
Bundle ' scrooloose/syntastic'
87
+ let g: ycm_python_binary_path = ' /usr/local/bin/python3'
85
88
let g: ycm_show_diagnostics_ui = 0
86
89
let g: syntastic_check_on_open = 1
87
90
let g: syntastic_cpp_checkers = [' clang++' ]
88
91
let g: syntastic_cpp_compiler = ' clang++'
89
92
let g: syntastic_cpp_compiler_options = ' -std=c++11 -stdlib=libc++'
90
93
94
+ " git clone https://github.com/Valloric/YouCompleteMe.git ~/.vim/bundle/YouCompleteMe
95
+ " git submodule update --init --recursive
96
+ " cd ~/.vim/bundle/YouCompleteMe && ./install.py --go-completer --clang-completer
91
97
Bundle ' Valloric/YouCompleteMe'
92
- " cd ~/.vim/bundle/YouCompleteMe && ./install.py --clang-completer
93
98
94
99
" 提示函数参数
95
100
" Bundle 'vim-scripts/echofunc.vim'
@@ -103,6 +108,9 @@ Bundle 'STL-Syntax'
103
108
" Bundle 'a.vim'
104
109
" Bundle 'derekwyatt/vim-fswitch'
105
110
111
+ " 去除行尾空格
112
+ Bundle ' bronson/vim-trailing-whitespace'
113
+
106
114
" Bundle 'c.vim'
107
115
Bundle ' ctags.vim'
108
116
Bundle ' taglist.vim'
@@ -118,21 +126,35 @@ Bundle 'surround.vim'
118
126
" non-GitHub repos
119
127
" CommandT
120
128
Bundle ' git://git.wincent.com/command-t.git'
121
- " cd ~/.vim/ruby/command-t && ruby extconf.rb && make
129
+ " cd ~/.vim/bundle/command-t/ ruby/command-t && ruby ext/command-t/ extconf.rb && rake make
122
130
" 命令:
123
131
" CommandTBuffer
124
132
" CommandT
125
- "
133
+ "
126
134
127
135
" gen tags
128
136
" Bundle 'vim-scripts/DfrankUtil'
129
137
" Bundle 'vim-scripts/vimprj'
130
138
" Bundle 'vim-scripts/indexer.tar.gz'
131
139
140
+ Bundle ' Chiel92/vim-autoformat'
141
+
142
+ " go
143
+ Bundle ' fatih/vim-go'
144
+ Bundle ' vim-jp/vim-go-extra'
145
+ Bundle ' dgryski/vim-godef'
146
+ Bundle ' Blackrush/vim-gocode'
147
+ Bundle ' zmb3/gogetdoc'
148
+ Bundle ' majutsushi/tagbar'
149
+
150
+ " jump, reuse the current window
151
+ let g: godef_split= 0
152
+ " brew install gotags
153
+
132
154
call vundle#end ()
133
155
134
156
" leader映射为逗号“,”
135
- let mapleader = " ,"
157
+ let mapleader = " ,"
136
158
137
159
" *****************************************************
138
160
" taglist配置 *
@@ -155,10 +177,11 @@ let Tlist_WinWidth=30
155
177
let Tlist_Exit_OnlyWindow= 1
156
178
" 单击跳转
157
179
let Tlist_Use_SingClick= 1
180
+
158
181
" 自动打开taglist
159
- " let Tlist_Auto_Open=1
160
- " Tlist 打开关闭快捷键 fn + F9
161
- nnoremap <silent> <F9 > :TlistToggle<CR>
182
+ let Tlist_Auto_Open= 1
183
+ " Tlist 打开关闭快捷键 fn + F1
184
+ nnoremap <silent> <F1 > :TlistToggle<CR>
162
185
let g: tagbar_autopreview = 1
163
186
164
187
@@ -191,14 +214,14 @@ let g:ycm_seed_identifiers_with_syntax=1
191
214
let g: ycm_global_ycm_extra_conf = ' ~/.vim/bundle/YouCompleteMe/third_party/ycmd/cpp/ycm/.ycm_extra_conf.py'
192
215
" 打开vim时不再询问是否加载ycm_extra_conf.py配置
193
216
let g: ycm_confirm_extra_conf= 0
194
- let g: ycm_semantic_triggers = {' c' : [' ->' , ' .' ], ' objc' : [' ->' , ' .' ], ' ocaml' : [' .' , ' #' ], ' cpp,objcpp' : [' ->' , ' .' , ' ::' ], ' php' : [' ->' , ' ::' ], ' cs,java,javascript,vim,coffee,python,scala,go' : [' .' ], ' ruby ' : [ ' . ' , ' :: ' ] }
217
+ let g: ycm_semantic_triggers = {' c' : [' ->' , ' .' ], ' objc' : [' ->' , ' .' ], ' ocaml' : [' .' , ' #' ], ' cpp,objcpp' : [' ->' , ' .' , ' ::' ], ' php' : [' ->' , ' ::' ], ' cs,java,javascript,vim,coffee,python,scala,go' : [' .' ]}
195
218
196
219
197
220
" Look for tag def in a "tags" file in the dir of the current file, then for
198
221
" that same file in every folder above the folder of the current file, until the
199
222
" root.
200
223
set tags = ./tags;/
201
- " gen systags:
224
+ " gen systags:
202
225
" ctags -R --fields=+aiKlSz --extra=+q --c++-kinds=+px .
203
226
" set notagbsearch
204
227
@@ -229,7 +252,7 @@ nmap <leader>l <Plug>(easymotion-overwin-line)
229
252
230
253
" F12 run python
231
254
map <F12> :!/usr/bin/python %
232
- map <F9 > :!~/go/bin/go run %
255
+ map <F11 > :!~/go/bin/go run %
233
256
234
257
235
258
filetype plugin indent on
@@ -244,14 +267,12 @@ if has("autocmd")
244
267
autocmd BufRead *.txt set tw = 78
245
268
" When editing a file, always jump to the last cursor position
246
269
autocmd BufReadPost *
247
- \ if line (" '\" " ) > 0 && line (" '\" " ) <= line (" $" ) |
248
- \ exe " normal g'\" " |
249
- \ endif
270
+ \ if line (" '\" " ) > 0 && line (" '\" " ) <= line (" $" ) |
271
+ \ exe " normal g'\" " |
272
+ \ endif
250
273
endif
251
274
" set bg=dark
252
275
253
- filetype plugin on
254
-
255
276
" highlight setting
256
277
" let c_no_curly_error=1
257
278
let g: ophigh_color = 226
@@ -260,17 +281,40 @@ let g:cpp_member_variable_highlight = 1
260
281
let g: cpp_experimental_simple_template_highlight = 1
261
282
let g: cpp_class_scope_highlight = 1
262
283
284
+ " "****************************************************
285
+ " auto format *
286
+ " *****************************************************
287
+ " clang-format for formating cpp code
288
+ nnoremap <leader> c :call FormatCode()<cr><cr>
289
+ vnoremap <leader> c :call FormatCode()<CR><CR>
290
+ " nnoremap <leader>lf :call FormatCode("LLVM")<cr>
291
+ " vnoremap <leader>lf :call FormatCode("LLVM")<cr>
292
+ let g: autoformat_verbosemode = 1
293
+ func FormatCode ()
294
+ let firstline= line (" ." )
295
+ let lastline= line (" ." )
296
+ " Visual mode
297
+ if exists (a: firstline )
298
+ firstline = a: firstline
299
+ lastline = a: lastline
300
+ endif
301
+ let g: formatdef_clangformat = " 'clang-format --lines='.a:firstline.':'.a:lastline.' --assume-filename='.bufname('%').' -style=file'"
302
+ let formatcommand = " :" . firstline . " ," . lastline . " Autoformat"
303
+ exec formatcommand
304
+ endfunc
263
305
264
306
" ***************python endent***************
307
+ filetype plugin on
308
+
265
309
function ! SET_PYTHON_IDENT ()
266
- set shiftwidth = 2
267
- set softtabstop = 2
268
- set tabstop = 2
269
- set backspace = 2
270
- set smarttab
271
- set cursorcolumn
310
+ set shiftwidth = 2
311
+ set softtabstop = 2
312
+ set tabstop = 2
313
+ set backspace = 2
314
+ set smarttab
315
+ set cursorcolumn
272
316
endfunction
273
- au FileType python,ruby, go :call SET_PYTHON_IDENT ()
317
+ au FileType python,go :call SET_PYTHON_IDENT ()
274
318
au FileType python set omnifunc = pythoncomplete#Complete
275
319
276
320
" Encoding related
@@ -284,23 +328,27 @@ set fileencoding=utf-8
284
328
set t_Co = 256
285
329
" set background=dark
286
330
set background = light
287
- " colorscheme monokai
331
+ " colorscheme monokai
288
332
" colorscheme molokai
289
333
" 暗色调主题,适合夜间
290
- colorscheme colorsbox- stnight
334
+ colorscheme colorsbox- stnight
335
+ " colorscheme colorsbox-steighties
291
336
" colorscheme colorsbox-faff
292
337
" colorscheme colorsbox-greenish
293
338
" colorscheme colorsbox-material
294
- " colorscheme colorsbox-stblue
295
- " colorscheme colorsbox-stbright
296
- " colorscheme colorsbox-steighties
339
+ " colorscheme colorsbox-stblue
340
+ " colorscheme colorsbox-stbright
297
341
" colorscheme wombat256
298
342
299
343
" 显示状态栏
300
344
set laststatus = 2
301
345
" 设置状态栏主题风格
302
- let g: Powerline_colorscheme= ' molokai256'
303
- let g: airline_theme = ' badwolf'
346
+ let g: Powerline_colorscheme= ' monokai256'
347
+ let g: airline_theme = ' badwolf'
348
+
349
+ " 显示行尾空格
350
+ highlight WhitespaceEOL ctermbg= red guibg= red
351
+ match WhitespaceEOL /"s"+$/
304
352
305
353
" Fast saving
306
354
" 前面leader为逗号“,”
@@ -310,6 +358,10 @@ noremap <leader>q :q!<cr>
310
358
noremap <leader> x :x<cr>
311
359
inoremap <leader> x <esc> :x<cr>
312
360
361
+
362
+ " 去除行尾空格快捷键
363
+ map <leader> <space> :FixWhitespace<cr>
364
+
313
365
" 上、下方向键
314
366
nmap j gj
315
367
nmap k gk
@@ -321,14 +373,15 @@ noremap <leader>t :CommandT<cr>
321
373
noremap <leader> s :vs<cr>
322
374
noremap <leader> p :sp<cr>
323
375
376
+ noremap <leader> d :<c-d><cr>
377
+ noremap <leader> u :<c-u><cr>
378
+
324
379
" 分屏多窗口跳转
325
380
noremap zj <c-w> j
326
381
noremap zk <c-w> k
327
382
noremap zl <c-w> l
328
383
noremap zh <c-w> h
329
384
330
-
331
-
332
385
" Ctrl + ] 多选择跳转
333
386
" nmap <c-]> g<c-]>
334
387
0 commit comments