-
Notifications
You must be signed in to change notification settings - Fork 2
/
.vimrc-8
320 lines (223 loc) · 6.36 KB
/
.vimrc-8
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
" tianjiqx vim configure
set nocompatible " be iMproved, required
filetype off " required
" history : how many lines of history VIM has to remember
set history=2000
" encoding
set encoding=utf-8
set termencoding=utf-8
filetype plugin indent on " required 启用自动补全
" use vim.plug manager plug
call plug#begin('~/.vim/plugged')
" support golang
Plug 'fatih/vim-go'
" auto complete
Plug 'ervandew/supertab'
" dir tree
Plug 'scrooloose/nerdtree'
Plug 'majutsushi/tagbar'
Plug 'flazz/vim-colorschemes'
Plug 'liuchengxu/space-vim-dark'
" file search
"Plug 'kien/ctrlp.vim'
" fuzzy search
Plug 'Yggdroot/LeaderF', { 'do': ':LeaderfInstallCExtension' }
"
Plug 'Raimondi/delimitMate'
" match{}, % goto
Plug 'tmhedberg/matchit'
"
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
"
"Plug 'rking/ag.vim'
Plug 'mileszs/ack.vim'
"markdown
Plug 'iamcco/markdown-preview.vim'
" c++ highlight
Plug 'octol/vim-cpp-enhanced-highlight'
" code completion for c++
" code auto format
Plug 'Chiel92/vim-autoformat'
" 基于缩进或语法进行代码折叠
"set foldmethod = indent
"set foldmethod=syntax
"cpp flod
"too slow
"Plugin 'LucHermitte/VimFold4C'
" All of your Plugins must be added before the following line
call plug#end() " required
" vim-go config
let g:go_fmt_command = "goimports"
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_structs = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
let g:go_highlight_function_calls = 1
let g:go_auto_type_info = 1
let g:go_auto_sameids = 1
"let g:go_fmt_experimental = 1
let mapleader=","
syntax on
au FileType go nmap <Leader>gd <Plug>(go-doc)
au FileType go nmap <Leader>gv <Plug>(go-doc-vertical)
au FileType go nmap <leader>r <Plug>(go-run)
au FileType go nmap <F4> :! go run %<CR>
au FileType go nmap <leader>b <Plug>(go-build)
au FileType go nmap <leader>t <Plug>(go-test)
au FileType go nmap <C-]> <Plug>(go-def)
au FileType go nmap <Leader>ds <Plug>(go-def-split)
au FileType go nmap <Leader>dv <Plug>(go-def-vertical)
au FileType go nmap <Leader>dt <Plug>(go-def-tab)
au FileType go nmap <Leader>i <Plug>(go-info)
" import tool show interface implements list
au FileType go nmap <Leader>s <Plug>(go-implements)
au FileType go nmap <Leader>e <Plug>(go-rename)
" SuperTab config
let g:SuperTabDefaultCompletionType = "<c-x><c-o>"
let g:SuperTabDefaultCompletionType = "context"
let g:SuperTabRetainCompletionType=2
" tagbar
let g:tagbar_ctags_bin='ctags'
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }
nmap <F8> :TagbarToggle<CR>
" Ctags
nmap <C-F12> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
set tags=./.tags;,.tags
" color config
" colorscheme molokai
colorscheme space-vim-dark
hi Comment guifg=#5C6370 ctermfg=59
" NERDTree config
autocmd vimenter * NERDTree
autocmd VimEnter * wincmd w
autocmd BufEnter * lcd %:p:h
map <F10> :NERDTreeToggle<CR>
" show hidden file
let NERDTreeShowHidden=1
" CtrlP
"let g:ctrlp_user_command = ['.git/', 'git --git-dir=%s/.git ls-files -oc --exclude-standard']
"set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.gz " MacOSX/Linux
"set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe " Windows
"let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$'
"let g:ctrlp_map = '<c-p>'
"let g:ctrlp_cmd = 'CtrlP'
" dlelimiatemate
" for python docstring
au FileType python let b:delimitMate_nesting_quotes = ['"']
"vim-airline
let g:airline_theme='murmur'
"markdown-preview
let g:mkdp_auto_start=0
let g:mkdp_auto_open=0
"c++ high light set
"高亮类,成员函数,标准库和模板
let g:cpp_class_scope_highlight = 1
let g:cpp_member_variable_highlight = 1
let g:cpp_concepts_highlight = 1
let g:cpp_experimental_simple_template_highlight = 1
" vim-autoformat
noremap <F6> :Autoformat<CR>
let g:formatdef_harttle = '"astyle --style=attach --pad-oper"'
let g:formatters_cpp = ['harttle']
"let g:formatters_java = ['harttle']
"cpp flod
"let g:fold_options = {
"" \ 'fold_blank': 0,
"" \ 'fold_includes': 0,
"" \ 'max_foldline_length': 'win',
"" \ 'merge_comments' : 1,
"" \ 'show_if_and_else': 1,
"" \ 'strip_namespaces': 1,
"" \ 'strip_template_arguments': 1
"" \ }
" Yggdroot/LeaderF conf
let g:Lf_ShortcutF = '<c-p>'
let g:Lf_ShortcutB = '<m-n>'
noremap <c-n> :LeaderfMru<cr>
noremap <F5> :LeaderfFunction<cr>
noremap <F6> :LeaderfLine<cr>
"noremap <m-n> :LeaderfBuffer<cr>
"noremap <m-m> :LeaderfTag<cr>
let g:Lf_StlSeparator = { 'left': '', 'right': '', 'font': '' }
let g:Lf_RootMarkers = ['.project', '.root', '.svn', '.git']
let g:Lf_WorkingDirectoryMode = 'Ac'
let g:Lf_WindowHeight = 0.30
let g:Lf_CacheDirectory = expand('~/.vim/cache')
let g:Lf_ShowRelativePath = 0
let g:Lf_HideHelp = 1
let g:Lf_StlColorscheme = 'powerline'
let g:Lf_PreviewResult = {'Function':0, 'BufTag':0}
" ack config
if executable('ag')
let g:ackprg = 'ag --vimgrep'
endif
noremap <leader>a :Ack!<cr>
" vim common config
" show line number
set number
"
set cursorline
" search
set hlsearch
set incsearch
" tab
set cindent
set tabstop=2
set shiftwidth=2
set expandtab "space replace tab
" editor
set t_Co=256 " Explicitly tell vim that the terminal has 256 colors "
set mouse=a " use mouse in all modes"
set scrolloff=5 " 5 lines above/below cursor when scrolling"
set showmatch " show matching bracket (briefly jump)
set showcmd " show typed command in status bar
set title " show file in titlebar"
set fdm=marker " flod
" share clipboard
set clipboard+=unnamed
" updatetime 100ms
set updatetime=100
"ignorecase
set ignorecase
" smart way to move between windows
map<C-j> <C-W>j
map<C-k> <C-W>k
map<C-h> <C-W>h
map<C-l> <C-W>l
" copy
vmap <leader>f "+y
nmap <leader>v "+gp
"
nnoremap <F2> :set nonumber! number?<CR>
nnoremap <F3> :set wrap! wrap?<CR>
" fix backupspace invalid
set backspace=indent,eol,start