forked from ma6174/vim
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
388 lines (307 loc) · 10.5 KB
/
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
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
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
" ============================================================================
" Vundle initialization
" Avoid modify this section, unless you are very sure of what you are doing
" no vi-compatible
set nocompatible
" Setting up Vundle - the vim plugin bundler
let iCanHazVundle=1
let vundle_readme=expand('~/.vim/bundle/Vundle.vim/README.md')
if !filereadable(vundle_readme)
echo "Installing Vundle..."
silent !mkdir -p ~/.vim/bundle
silent !git clone https://github.com/VundleVim/Vundle.vim ~/.vim/bundle/Vundle.vim
let iCanHazVundle=0
endif
filetype off
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle, required
Plugin 'VundleVim/Vundle.vim'
" ============================================================================
" Active plugins
" You can disable or add new ones here:
" Plugins from github repos:
" Better file browser
Plugin 'scrooloose/nerdtree'
" A plugin of NERDTree showing git status flags
Plugin 'Xuyuanp/nerdtree-git-plugin'
" Code commenter
Plugin 'scrooloose/nerdcommenter'
Plugin 'mrtazz/DoxygenToolkit.vim'
" Class/module browser
Plugin 'majutsushi/tagbar'
" Code and files fuzzy finder
Plugin 'ctrlpvim/ctrlp.vim'
" Plugin 'ivan-cukic/vim-ctrlp-cscope'
Plugin 'hari-rangarajan/CCTree'
" Git integration
Plugin 'motemen/git-vim'
" Tab list panel
Plugin 'kien/tabman.vim'
" Airline
Plugin 'vim-airline/vim-airline'
Plugin 'vim-airline/vim-airline-themes'
" Terminal Vim with 256 colors colorscheme
Plugin 'fisadev/fisa-vim-colorscheme'
" Surround
Plugin 'tpope/vim-surround'
" Autoclose
Plugin 'Townk/vim-autoclose'
" Indent text object
Plugin 'michaeljsmith/vim-indent-object'
" Python mode (indentation, doc, refactor, lints, code checking, motion and
" operators, highlighting, run and ipdb breakpoints)
Plugin 'python-mode/python-mode'
" Better autocompletion
Plugin 'Shougo/neocomplete.vim'
" A common extensible interface for searching and displaying lists
" of information from within vim.
" Plugin 'Shougo/denite.nvim'
" a fast, as-you-type, fuzzy-search code completion engine for Vim
" Plugin 'Valloric/YouCompleteMe'
" Snippets manager (SnipMate), dependencies, and snippets repo
Plugin 'MarcWeber/vim-addon-mw-utils'
Plugin 'tomtom/tlib_vim'
Plugin 'honza/vim-snippets'
" Plugin 'garbas/vim-snipmate'
" Git/mercurial/others diff icons on the side of the file lines
Plugin 'mhinz/vim-signify'
" Automatically sort python imports
" Plugin 'fisadev/vim-isort'
" Drag visual blocks arround
Plugin 'fisadev/dragvisuals.vim'
" Window chooser
Plugin 't9md/vim-choosewin'
" Python and other languages code checker
Plugin 'scrooloose/syntastic'
" Paint css colors with the real color
Plugin 'lilydjwg/colorizer'
" smart cscope helper for vim
" Plugin 'vim-scripts/cscope.vim'
" Search results counter
Plugin 'IndexedSearch'
" XML/HTML tags navigation
Plugin 'matchit.zip'
" Gvim colorscheme
Plugin 'Wombat'
" Yank history navigation
Plugin 'YankRing.vim'
" log view
Plugin 'vim-scripts/oops_trace.vim'
" ascii draw
"Plugin 'vim-scripts/DrawIt'
"Plugin 'vim-scripts/sketch.vim'
" Folding
Plugin 'Konfekt/FastFold'
" Provide syntax for the neomutt configuration file
Plugin 'neomutt/neomutt.vim'
" provides Rust file detection, syntax highlighting, formatting, Syntastic integration, and more.
Plugin 'rust-lang/rust.vim'
" ===========================================================================
" Below plugins are mostly used, uncomment them to enable
" Consoles as buffers
" Plugin 'rosenfeld/conque-term'
" Python and PHP Debugger
" Plugin 'fisadev/vim-debug.vim'
" Extension to ctrlp, for fuzzy command finder
" Plugin 'fisadev/vim-ctrlp-cmdpalette'
" Zen coding
" Plugin 'mattn/emmet-vim'
" Code snippets engine for Vim
" Plugin 'drmingdrmer/xptemplate'
" All of your Plugins must be added before the following line
call vundle#end() " required
" ============================================================================
" Install plugins the first time vim runs
if iCanHazVundle == 0
echo "Installing Plugins, please ignore key map error messages"
:PluginInstall
endif
" ============================================================================
" Vim settings and mappings, You can edit them as you wish
let mapleader = ","
" allow plugins by file type (required for plugins!)
filetype plugin indent on
" tabs and spaces handling
set noexpandtab
set tabstop=8
set softtabstop=8
set shiftwidth=8
" tab length exceptions on some file types
autocmd FileType html setlocal shiftwidth=2 tabstop=2 softtabstop=2
autocmd FileType htmldjango setlocal shiftwidth=2 tabstop=2 softtabstop=2
autocmd FileType javascript setlocal shiftwidth=2 tabstop=2 softtabstop=2
" remember last position
au BufWinLeave ?* silent mkview
au BufWinEnter ?* silent loadview | set nofoldenable
" highlight current line
set cursorline
hi CursorLine cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
" right margin
set colorcolumn=81
set textwidth=80
set wrapmargin=80
set formatoptions-=t
" always show status bar
set ls=2
" incremental search
set incsearch
" highlighted search results
set hlsearch
" syntax highlight on
syntax on
" show line numbers
set nu
" set folding
set foldmethod=syntax
augroup OpenAllFoldsOnFileOpen
autocmd!
autocmd BufRead * normal zR
augroup END
" show our help doc
nmap <F2> :tabnew ~/.vim/tips.md<CR>
" formate c code
nmap <F5> :%!astyle --mode=c --style=linux<CR>
" past mode swticher
set pastetoggle=<F6>
" vimgrep and quickfix
:nnoremap <F7> :cnext<CR>
:nnoremap <S-F7> :cprev<CR>
au FileType qf wincmd J
augroup vim-grep
autocmd!
autocmd QuickFixCmdPost [^l]* cwindow
autocmd QuickFixCmdPost l* lwindow
augroup END
" tab navigation mappings
map <C-S-Right> :tabnext<CR>
imap <C-S-Right> <ESC>:tabnext<CR>
map <C-S-Left> :tabprevious<CR>
imap <C-S-Left> <ESC>:tabprevious<CR>
" navigate windows with meta+arrows
map <M-Right> <c-w>l
map <M-Left> <c-w>h
map <M-Up> <c-w>k
map <M-Down> <c-w>j
imap <M-Right> <ESC><c-w>l
imap <M-Left> <ESC><c-w>h
imap <M-Up> <ESC><c-w>k
imap <M-Down> <ESC><c-w>j
" old autocomplete keyboard shortcut
imap <C-J> <C-X><C-O>
" spell checking
set spelllang=en_us
hi clear SpellBad
map <silent> <C-S> :set spell!<CR>
autocmd FileType gitcommit,rst,text,markdown setlocal spell
autocmd FileType gitcommit,rst,text,markdown
\ set colorcolumn=76 | set textwidth=75 |
\ hi clear SpellBad | hi SpellBad cterm=underline |
\ hi clear SpellCap | hi link SpellCap SpellBad |
\ hi clear SpellLocal | hi link SpellLocal SpellBad |
\ hi clear SpellRare | hi link SpellRare SpellBad
" Comment this line to enable autocompletion preview window
" (displays documentation related to the selected completion option)
" Disabled by default because preview makes the window flicker
set completeopt-=preview
" save as sudo
ca w!! w !sudo tee "%"
" use 256 colors when possible
if &term =~? 'mlterm\|xterm\|xterm-256\|screen-256'
let &t_Co = 256
colorscheme fisa
else
colorscheme delek
endif
" colors for gvim
if has('gui_running')
colorscheme wombat
endif
" when scrolling, keep cursor 3 lines away from screen border
set scrolloff=3
" autocompletion of files and commands behaves like shell
" (complete only the common part, list the options that match)
set wildmode=list:longest
" highlight extra whitespace
highlight ExtraWhitespace ctermbg=red guibg=red
match ExtraWhitespace /\s\+$/
" ============================================================================
" Plugins settings and mappings
" Edit them as you wish.
" Tagbar -----------------------------
" toggle tagbar display
map <F4> :TagbarToggle<CR>
autocmd FileType * nested :call tagbar#autoopen()
let g:tagbar_autofocus = 0
let g:tagbar_compact = 1
let g:tagbar_autoclose = 0
let g:tagbar_autopreview = 0
let g:tagbar_sort = 0
let g:tagbar_autoshowtag = 1
" Vim-debug ------------------------------
" disable default mappings, have a lot of conflicts with other plugins
let g:vim_debug_disable_mappings = 1
" Syntastic ------------------------------
" show list of errors and warnings on the current file
nmap <leader>e :Errors<CR>
" check also when just opened the file
let g:syntastic_check_on_open = 1
" don't put icons on the sign column (it hides the vcs status icons of signify)
let g:syntastic_enable_signs = 0
" TabMan ------------------------------
" mappings to toggle display, and to focus on it
let g:tabman_toggle = 'tl'
let g:tabman_focus = 'tf'
" Autoclose ------------------------------
" Fix to let ESC work as espected with Autoclose plugin
let g:AutoClosePumvisible = {"ENTER": "\<C-Y>", "ESC": "\<ESC>"}
" DragVisuals ------------------------------
" mappings to move blocks in 4 directions
vmap <expr> <S-M-LEFT> DVB_Drag('left')
vmap <expr> <S-M-RIGHT> DVB_Drag('right')
vmap <expr> <S-M-DOWN> DVB_Drag('down')
vmap <expr> <S-M-UP> DVB_Drag('up')
" mapping to duplicate block
vmap <expr> D DVB_Duplicate()
" Window Chooser ------------------------------
" mapping
nmap - <Plug>(choosewin)
" show big letters
let g:choosewin_overlay_enable = 1
" Airline ------------------------------
let g:airline_powerline_fonts = 0
let g:airline_theme = 'light'
let g:airline#extensions#whitespace#enabled = 0
" NERDTree -----------------------------
" open a NERDTree automatically when vim starts up if no files were specified
autocmd StdinReadPre * let s:std_in=1
autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
" toggle nerdtree display
map <F3> :NERDTreeToggle<CR>
" open nerdtree with the current file selected
nmap <leader>t :NERDTreeFind<CR>
" don;t show these file types
let NERDTreeIgnore = ['\.pyc$', '\.pyo$']
" Signify ------------------------------
" this first setting decides in which order try to guess your current vcs
" UPDATE it to reflect your preferences, it will speed up opening files
let g:signify_vcs_list = [ 'git', 'hg' ]
" mappings to jump to changed blocks
nmap <leader>sn <plug>(signify-next-hunk)
nmap <leader>sp <plug>(signify-prev-hunk)
" nicer colors
highlight DiffAdd cterm=bold ctermbg=none ctermfg=119
highlight DiffDelete cterm=bold ctermbg=none ctermfg=167
highlight DiffChange cterm=bold ctermbg=none ctermfg=227
highlight SignifySignAdd cterm=bold ctermbg=237 ctermfg=119
highlight SignifySignDelete cterm=bold ctermbg=237 ctermfg=167
highlight SignifySignChange cterm=bold ctermbg=237 ctermfg=227
" Other plugin configs ------------------------
source ~/.vim/plugin_cfg/backup.vim
" grep, CtrlP, Cscope
source ~/.vim/plugin_cfg/search.vim
source ~/.vim/plugin_cfg/python-mode.vim
source ~/.vim/plugin_cfg/neocomplete.vim
"source ~/.vim/plugin_cfg/youcompleteme.vim
source ~/.vim/plugin_cfg/highlight.vim
source ~/.vim/plugin_cfg/log.vim