-
Notifications
You must be signed in to change notification settings - Fork 0
/
vimrc
476 lines (374 loc) · 14.2 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
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
"
" .vimrc - Kris Pritchard
"
" NeoBundle
if has('vim_starting')
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
call neobundle#begin(expand('~/.vim/bundle/'))
NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'Shougo/vimproc.vim', {
\ 'build' : {
\ 'windows' : 'tools\\update-dll-mingw',
\ 'cygwin' : 'make -f make_cygwin.mak',
\ 'mac' : 'make',
\ 'linux' : 'make',
\ 'unix' : 'gmake',
\ },
\ }
NeoBundle 'Shougo/neomru.vim'
NeoBundle 'Shougo/unite.vim'
nnoremap <leader>l :Unite -silent -start-insert file file_rec/async buffer file_mru<CR>
nnoremap <leader>x :Unite line<CR>
let mapleader = ' ' " Bind <leader> key to space.
NeoBundle 'tpope/vim-fugitive' " Git wrapper
NeoBundle 'airblade/vim-gitgutter' " Git diffs in gutter
NeoBundle 'Lokaltog/vim-easymotion' " Enhanced motion navigation
NeoBundle 'scrooloose/nerdtree'
""let loaded_nerd_tree=0 " Load NERDTree at startup
let NERDChrismasTree=1 " Additional syntax highlighting
let NERDTreeDirArrows=0 " Current font is missing unicode arrows
map <leader>n :NERDTreeToggle<cr>
NeoBundle 'Xuyuanp/nerdtree-git-plugin'
let g:NERDTreeIndicatorMapCustom = {
\ "Modified" : "M",
\ "Staged" : "✚",
\ "Untracked" : "U",
\ "Renamed" : "R",
\ "Unmerged" : "═",
\ "Deleted" : "✖",
\ "Dirty" : "D",
\ "Clean" : "C",
\ "Unknown" : "?"
\ }
NeoBundle 'jistr/vim-nerdtree-tabs' " Better nerdtree support w/ tabs
NeoBundle 'scrooloose/nerdcommenter' " Smart commenting out of code
map <leader>' :ConqueTermSplit bpython<CR>
NeoBundle 'tpope/vim-surround' " Adds additional surround functionality
NeoBundle 'tpope/vim-repeat' " Smarter repeat using .
NeoBundle 'krp/vim-sensible' " Sane default. tpope fork w/ additions.
NeoBundle 'krp/conque' " Run programs inside buffer
NeoBundle 'krp/molokai.vim' " #1 colorscheme
NeoBundle 'evanmiller/nginx-vim-syntax'
" Python-mode. Additional python features.
NeoBundle 'klen/python-mode'
let g:pymode_lint = 1
let g:pymode_lint_checker = "pyflakes"
let g:pymode_lint_write = 1
let g:pymode_run_key = '<leader>a'
" Use jedi instead
let g:pymode_rope = 0
" Override go-to.definition key shortcut to Ctrl-]
"let g:pymode_rope_goto_definition_bind = "<C-]>"
"let g:pymode_breakpoint_key = '<leader>b'
"let g:pymode_syntax = 1
"let g:pymode_syntax_all = 1
"let g:pymode_syntax_indent_errors = g:pymode_syntax_all
"let g:pymode_syntax_space_errors = g:pymode_syntax_all
let g:pymode_folding = 1
" Rope makes vim horrendously slow. See help :pymode-rope-slow
let g:pymode_rope_lookup_project = 0
" Disable ipdb settrace default binding of <leader>b
let g:pymode_breakpoint = 0
let g:pymode_options_max_line_length = 120
" Rainbow Parentheses. Consider switching to junegunn's maintained fork.
NeoBundle 'krp/rainbow_parentheses.vim'
NeoBundle 'ctrlpvim/ctrlp.vim' " Fuzzy file/buffer/mru/tag finder.
let g:ctrlp_map = '<leader>t'
set wildignore+=*/tmp/*,*/venv/*,*/node_modules/*
set wildignore+=*.so,*.swp,*~,*.zip
let g:ctrlp_custom_ignore = {
\ 'dir': '\v[\/]\.(git|hg|svn)$',
\ 'file': '\v\.(exe|so|dll|pyc)$',
\ 'link': 'some_bad_symbolic_links',
\ }
"nmap <leader>y :CtrlPBuffer<cr>
NeoBundle 'tacahiroy/ctrlp-funky'
let g:ctrlp_extensions = ['funky']
NeoBundle 'majutsushi/tagbar' " Tagbar
nmap <leader>r :TagbarToggle<cr>
NeoBundle 'vim-scripts/cscope_macros.vim' " cscope. Run cscope -R in code dir.
"" ListToggle
NeoBundle 'Valloric/ListToggle' " Display quickfix/location lists.
let g:lt_location_list_toggle_map = '<leader>l'
let g:lt_quickfix_list_toggle_map = '<leader>q'
let g:lt_height = 10
NeoBundle 'terryma/vim-expand-region' " Expand visual mode by region
"map K <Plug>(expand_region_expand)
"map J <Plug>(expand_region_shrink)
NeoBundle 'rking/ag.vim' " Silver searcher
NeoBundle 'vim-airline/vim-airline' " Vim Airline
NeoBundle 'vim-airline/vim-airline-themes' " Vim Airline themes
let g:airline_left_sep=''
let g:airline_right_sep=''
let g:airline_theme='simple'
" pytest.vim
NeoBundle 'alfredodeza/pytest.vim'
nmap <silent><Leader>f <Esc>:Pytest file<CR>
nmap <silent><Leader>c <Esc>:Pytest class<CR>
nmap <silent><Leader>m <Esc>:Pytest method<CR>
map <leader>s <Esc>:Pytest session<CR>
"" jedi python autocompletion
"NeoBundle 'davidhalter/jedi-vim'
"let g:jedi#popup_on_dot = 0
"let g:jedi#use_splits_not_buffers = "left"
NeoBundle 'mattn/emmet-vim' " emmet.io. HTML/CSS toolkit
NeoBundle 'zah/nimrod.vim' " Nim language support
NeoBundle 'nathanaelkane/vim-indent-guides'
" <leader>ig is default binding for toggling indentation guides
"NeoBundle 'jaxbot/selective-undo.vim'
NeoBundle 'Wolfy87/vim-enmasse'
"NeoBundle 'FriedSock/smeargle' " Might be useful in combo w/ rain_parens
" NOTE: Requires installation of node packages in order to work.
" cd to tern_for_vim dir and run npm install
NeoBundle 'marijnh/tern_for_vim'
" XXX: Deprecate this and replace w/ ESLint at some point
NeoBundle 'Shutnik/jshint2.vim'
let jshint2_save = 1
let jshint2_confirm = 0
" jshint validation
nnoremap <silent><F1> :JSHint<CR>
inoremap <silent><F1> <C-O>:JSHint<CR>
vnoremap <silent><F1> :JSHint<CR>
" show next jshint error
nnoremap <silent><F2> :lnext<CR>
inoremap <silent><F2> <C-O>:lnext<CR>
vnoremap <silent><F2> :lnext<CR>
" show previous jshint error
nnoremap <silent><F3> :lprevious<CR>
inoremap <silent><F3> <C-O>:lprevious<CR>
vnoremap <silent><F3> :lprevious<CR>
NeoBundle 'godlygeek/tabular'
NeoBundle 'einars/js-beautify'
NeoBundle 'maksimr/vim-jsbeautify'
"map <leader>b :call JsBeautify()<cr>
" or
"autocmd FileType javascript noremap <buffer> <leader>b :call JsBeautify()<cr>
" for html
"autocmd FileType html noremap <buffer> <leader>b :call HtmlBeautify()<cr>
" for css or scss
"autocmd FileType css noremap <buffer> <leader>b :call CSSBeautify()<cr>
NeoBundle 'rhysd/vim-clang-format'
let g:clang_format#style_options = {
\ "AccessModifierOffset" : -4,
\ "AllowShortIfStatementsOnASingleLine" : "true",
\ "AlwaysBreakTemplateDeclarations" : "true",
\ "Standard" : "C++11",
\ "BreakBeforeBraces" : "Stroustrup"}
" map to <Leader>cf in C++ code
autocmd FileType c,cpp,objc nnoremap <buffer><Leader>cf :<C-u>ClangFormat<CR>
autocmd FileType c,cpp,objc vnoremap <buffer><Leader>cf :ClangFormat<CR>
" if you install vim-operator-user
autocmd FileType c,cpp,objc map <buffer><Leader>x <Plug>(operator-clang-format)
" Toggle auto formatting:
nmap <Leader>C :ClangFormatAutoToggle<CR>
NeoBundle 'terryma/vim-multiple-cursors'
NeoBundle 'editorconfig/editorconfig-vim'
NeoBundle 'junegunn/goyo.vim' " Distraction-free writing in Vim
" Switch to distraction-free mode with leader-G
nmap <leader>g :Goyo<CR>
NeoBundle 'KabbAmine/zeavim.vim' " Zeal for vim
NeoBundle 'ujihisa/unite-colorscheme'
NeoBundle 'osyo-manga/vim-anzu'
" mapping
nmap n <Plug>(anzu-n-with-echo)
nmap N <Plug>(anzu-N-with-echo)
nmap * <Plug>(anzu-star-with-echo)
nmap # <Plug>(anzu-sharp-with-echo)
" Syntax
NeoBundle 'ethereum/vim-solidity'
NeoBundle 'digitaltoad/vim-pug'
NeoBundle 'posva/vim-vue'
NeoBundle 'mxw/vim-jsx'
NeoBundle 'jbgutierrez/vim-babel'
NeoBundle 'pangloss/vim-javascript'
NeoBundle 'sjl/badwolf'
NeoBundle 'rakr/vim-one'
NeoBundle 'bkad/CamelCaseMotion'
" clear status
nmap <Esc><Esc> <Plug>(anzu-clear-search-status)
" anzu statusline
set statusline=%{anzu#search_status()}
call neobundle#end()
filetype plugin indent on " Enable indent plugin - Required by NeoBundle/Vundle
"let g:mapleader = "\" " Use \ as leader key. Disabled.
set encoding=utf-8 " Necessary for unicode glyphs
set t_Co=256 " 256 color terminal support
"let g:Powerline_symbols = 'fancy' " Requires a patched font.
"let g:Powerline_symbols = 'unicode'
"let g:Powerline_symbols = 'compatible'
syntax enable
set modeline
" Tabs/spaces/etc.
set tabstop=4
set expandtab
set softtabstop=4
set shiftwidth=4
filetype plugin on " Enable
"set omnifunc=syntaxcomplete#Complete
set linespace=3 " Num pixel lines inserted between characters.
set breakindent " Continue linebreaks at correct indentation
set linebreak " Wrap lines at 'breakat' char.
" Set 'jj' to Esc. Good for computers w/o capslock rebinding.
inoremap jj <Esc>
" Enable mouse scrolling in terminal vim
set mouse=a
" Eliminate windows line endings: %s/<Ctrl-V><Ctrl-M>//g
" Fast saving. Press leader+w to write changes to file
nmap <leader>w :w!<cr>
" Fast editing of .vimrc. Press leader+e to edit vimrc.
map <leader>e :e! $MYVIMRC<cr>
"nnoremap <leader>ev <C-w><C-v><C-l>:e $MYVIMRC<cr> " Steve Losh's binding for
"above command. Opens it in a new split window.
" Vertically split window switch cursor focus with leader+v.
set splitright
set splitbelow
nnoremap <leader>v <C-w>v<C-w>l
" Cycle through buffers
"map <F2> :bprevious<CR>
"map <F3> :bnext<CR>
" ctags file
" Requires that ctags is installed, and that you run ctags -R in the root of
" your code directory
set tags=./tags;$HOME/programming/
" When vimrc is edited and saved, automatically reload it
autocmd! bufwritepost vimrc source ~/.vimrc
" Disable italic/etc attributes from color schemes
" set gui=NONE
" set cterm=NONE
" set term=NONE
":sp $VIMRUNTIME/syntax/hitest.vim | source % " Display all colors
" GUI options
if has('gui_running')
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
set guioptions-=r "remove right-hand scroll bar
endif
" run python script
map ,t :w\|:!python %<CR>
" close buffer
map <leader>x :bdelete<CR>
" Tpope's sensible.vim handles
" autoindent, backspace, complete, smarttab, nrformats, ttimeout,
" ttimeoutlen=100, incsearch, laststatus, history, etc.
" Move defaults from here to there.
set autowrite " Writes on make/shell commands
set autoread
set timeoutlen=250 " Time to wait after ESC, 0 bugs out some keypresses
set clipboard+=unnamed " Yanks go on clipboard instead.
set cursorline " Highlight current line
" Toggle hlsearch off with leader+h, or just type :noh.
set hlsearch
map <leader>h :nohlsearch<CR>
"set nowrap
"set textwidth=0 " Don't wrap lines by default
" Enable wrapping with:
set wrap
set linebreak " Only wrap at a character in 'breakat' option
set nolist " Disables adding linebreaks where there shouldn't be any
set wrapmargin=0
" set wildmode=list:longest " Makes the autocompletion take up much more
" screen space
set ttyfast " Indicates fast terminal connection. See :help ttyfast
set relativenumber " Show relative line numbers. Allows faster vertical motion
set number " Show actual line number of cursor instead of just '0'.
set undofile " vim 7.3 feature which creates <FILENAME>.un~ for persistent undo
" Use ordinary regex handling instead of vim's
" Doesn't seem to work
"nnoremap / /\v
"vnoremap / /\/
set gdefault " With :s/foo/bar/g, globally substitute all matches on line without needing /g
set showmatch " Briefly show where matching bracket is when one is inserted.
" Uses tab to match bracket pairs instead of using %
nnoremap <tab> %
vnoremap <tab> %
set textwidth=79 " Wrap lines after 79 chars except in paste mode
set formatoptions=qrn1 " Wrapping options. See :help fo-table
"set colorcolumn=120 " Show colored column after 85 chars.
nnoremap j gj
nnoremap k gk
" Disable help on F1 keypress. Avoids accidentally hitting it if you press Esc.
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
" Neovim terminal bindings
if has('nvim')
tnoremap <Esc> <C-\><C-n>
tnoremap <C-h> <C-\><C-n><C-w>h
tnoremap <C-j> <C-\><C-n><C-w>j
tnoremap <C-k> <C-\><C-n><C-w>k
tnoremap <C-l> <C-\><C-n><C-w>l
endif
" Easier split swaps
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Automatically write changes to file after losing focus.
au FocusLost * :wa
" Strip all trailing whitespace from current file
nnoremap <leader>W :%s/\s\+%//<cr>:let @/=''<cr>
" Command and Auto commands " {{{
" Sudo write - just type :W if you edit a file without root permissions
" it'll prompt for your sudo password, then write the file as root.
comm! W exec 'w !sudo tee % > /dev/null' | e!
" Use <leader>l to toggle display of whitespace
nmap <leader>, :set list!<CR>
exec "set listchars=tab:\uBB\uBB,trail:\uB7,nbsp:~,eol:¬"
" Show arrow at beginning of wrapped lines.
let &showbreak='↪ '
" CamelCaseMotion
"call camelcasemotion#CreateMotionMappings('<leader>')
map <silent> w <Plug>CamelCaseMotion_w
map <silent> b <Plug>CamelCaseMotion_b
map <silent> e <Plug>CamelCaseMotion_e
map <silent> ge <Plug>CamelCaseMotion_ge
sunmap w
sunmap b
sunmap e
sunmap ge
omap <silent> iw <Plug>CamelCaseMotion_iw
xmap <silent> iw <Plug>CamelCaseMotion_iw
omap <silent> ib <Plug>CamelCaseMotion_ib
xmap <silent> ib <Plug>CamelCaseMotion_ib
omap <silent> ie <Plug>CamelCaseMotion_ie
xmap <silent> ie <Plug>CamelCaseMotion_ie
" from Damian Conway
"highlight ColorColumn ctermbg=magenta
"call matchadd('ColorColumn', '\%81v', 100)
function! HLNext (blinktime)
let [bufnum, lnum, col, off] = getpos('.')
let matchlen = strlen(matchstr(strpart(getline('.'),col-1),@/))
let target_pat = '\c\%#'.@/
let ring = matchadd('WhiteOnRed', target_pat, 101)
redraw
exec 'sleep ' . float2nr(a:blinktime * 1000) . 'm'
call matchdelete(ring)
redraw
endfunction
" Always on
au VimEnter * RainbowParenthesesToggle
au Syntax * RainbowParenthesesLoadRound
au Syntax * RainbowParenthesesLoadSquare
au Syntax * RainbowParenthesesLoadBraces
let g:rbpt_colorpairs = [
\ ['Darkblue', 'SeaGreen3'],
\ ['magenta', 'DarkOrchid3'],
\ ['darkgreen', 'firebrick3'],
\ ['darkcyan', 'RoyalBlue3'],
\ ['darkred', 'DarkOrchid3'],
\ ['darkyellow', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['darkblue', 'firebrick3'],
\ ['blue', 'RoyalBlue3'],
\ ['cyan', 'SeaGreen3'],
\ ['darkmagenta', 'DarkOrchid3'],
\ ['magenta', 'firebrick3'],
\ ['yellow', 'RoyalBlue3'],
\ ['darkgreen', 'RoyalBlue3'],
\ ['darkblue', 'SeaGreen3'],
\ ['red', 'firebrick3'],
\ ]
"map <leader>R :RainbowParenthesesToggle<cr>
NeoBundleCheck
colorscheme molokai