-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path.vimrc
More file actions
511 lines (444 loc) · 16.8 KB
/
.vimrc
File metadata and controls
511 lines (444 loc) · 16.8 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
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
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
" My Bundles
Bundle 'altercation/vim-colors-solarized'
Bundle 'scrooloose/nerdtree'
Bundle 'ervandew/supertab'
Bundle 'kien/ctrlp.vim'
Bundle 'majutsushi/tagbar'
Bundle 'garbas/vim-snipmate'
Bundle 'honza/vim-snippets'
Bundle 'Lokaltog/vim-easymotion'
Bundle 'plasticboy/vim-markdown'
" Bundle 'jszakmeister/markdown2ctags'
Bundle 'ivanov/vim-ipython'
" Vim Tmux - Send code to another tmux pane
Bundle 'benmills/vimux'
Bundle 'julienr/vimux-pyutils'
" C-c will paste and execute the currently selected block in ipython
" C-b will execute the current cell in ipython A cell is similar to MATLAB's cell and is defined as the line ranging from the previous ## to the next ##
Bundle 'oblitum/rainbow'
Bundle 'jansenm/vim-cmake'
"interpret a file by function and cache file automatically
Bundle 'MarcWeber/vim-addon-mw-utils'
"Some utility functions for VIM
Bundle 'tomtom/tlib_vim'
Bundle 'rstacruz/sparkup'
" Syntax checking
Bundle 'scrooloose/syntastic'
Bundle 'Townk/vim-autoclose'
Bundle 'tpope/vim-fugitive'
Bundle 'tpope/vim-repeat'
Bundle 'tpope/vim-surround'
Bundle 'edsono/vim-matchit'
Bundle 'vim-scripts/django.vim'
Bundle 'vim-scripts/scons.vim'
Bundle 'vim-scripts/c.vim'
Bundle 'vim-scripts/python.vim'
Bundle 'groenewege/vim-less'
" Multiple cursors
" Bundle 'terryma/vim-multiple-cursors'
" C-n
"Bundle 'vim-jp/cpp-vim'
Bundle 'Yggdroot/indentLine'
Bundle 'mileszs/ack.vim'
" Bundle 'kshenoy/vim-signature'
" Bundle 'vim-scripts/LanguageTool'
" Bundle 'sjl/gundo.vim'
" Bundle 'vim-scripts/Smartput'
filetype plugin indent on " required!
"
" Brief help
" :BundleList - list configured bundles
" :BundleInstall(!) - install(update) bundles
" :BundleSearch(!) foo - search(or refresh cache first) for foo
" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles
"
" see :h vundle for more details or wiki for FAQ
" NOTE: comments after Bundle command are not allowed.
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Basics
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set encoding=utf-8
set nocompatible " get out of vi-compatible mode
set noexrc " don't use local version of .(g)vimrc, .exrc
""highlight Normal
"let g:solarized_termcolors=256
set background=dark " we plan to use a dark background
colorscheme solarized
" Change color after line 80
let &colorcolumn=join(range(81,999),",")
highlight ColorColumn ctermbg=235 guibg=#2c2d27
set cpoptions=aABceFsmq
" |||||||||
" ||||||||+-- When joining lines, leave the cursor
" ||||||| between joined lines
" |||||||+-- When a new match is created (showmatch)
" |||||| pause for .5
" ||||||+-- Set buffer options when entering the
" ||||| buffer
" |||||+-- :write command updates current file name
" ||||+-- Automatically add <CR> to the last line
" ||| when using :@r
" |||+-- Searching continues at the end of the match
" || at the cursor position
" ||+-- A backslash has no special meaning in mappings
" |+-- :write updates alternative file name
" +-- :read updates alternative file name
syntax on " syntax highlighting on
set noswapfile
set nobackup
set nowb
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" General
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"set autochdir " always switch to the current file directory
set backspace=indent,eol,start " make backspace a more flexible
"set backup " make backup files
"set backupdir=~/.vim/backup " where to put backup files
set clipboard=unnamed " share windows clipboard
"set directory=~/.vim/tmp " directory to place swap files in
set fileformats=unix,dos,mac " support all three, in this order
" set hidden " you can change buffers without saving
" (XXX: #VIM/tpope warns the line below could break things)
set iskeyword+=_,$,@,%,# " none of these are word dividers
set mouse=a " use mouse everywhere
set noerrorbells " don't make noise
set whichwrap=b,s,h,l,<,>,~,[,] " everything wraps
" | | | | | | | | |
" | | | | | | | | +-- "]" Insert and Replace
" | | | | | | | +-- "[" Insert and Replace
" | | | | | | +-- "~" Normal
" | | | | | +-- <Right> Normal and Visual
" | | | | +-- <Left> Normal and Visual
" | | | +-- "l" Normal and Visual (not recommended)
" | | +-- "h" Normal and Visual (not recommended)
" | +-- <Space> Normal and Visual
" +-- <BS> Normal and Visual
set wildmenu " turn on command line completion wild style
" ignore these list file extensions
set wildignore=*.dll,*.o,*.obj,*.bak,*.exe,*.pyc,
\*.jpg,*.gif,*.png
set wildmode=list:longest " turn on wild mode huge list
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Vim UI
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set ignorecase
set cursorcolumn " highlight the current column
set cursorline " highlight current line
set hlsearch " highlight searched for phrases
set incsearch " BUT do highlight as you type you
" search phrase
set laststatus=2 " always show the status line
set lazyredraw " do not redraw while running macros
set linespace=0 " don't insert any extra pixel lines
" betweens rows
set list " we do whant to show tabs, to ensure we get them
" out of my files
set listchars=tab:>-,trail:- " show tabs and trailing
set matchtime=5 " how many tenths of a second to blink
" matching brackets for
"set nohlsearch " do not highlight searched for phrases
set nostartofline " leave my cursor where it was
set novisualbell " don't blink
set number " turn on line numbers
set numberwidth=5 " We are good up to 99999 lines
set report=0 " tell us when anything is changed via :...
set ruler " Always show current positions along the bottom
set scrolloff=10 " Keep 10 lines (top/bottom) for scope
set shortmess=aOstT " shortens messages to avoid
" 'press a key' prompt
set showcmd " show the command being typed
set showmatch " show matching brackets
set sidescrolloff=10 " Keep 5 lines at the size
set statusline=%F%m%r%h%w[%L][%{&ff}]%y[%p%%][%04l,%04v]
" | | | | | | | | | | |
" | | | | | | | | | | + current
" | | | | | | | | | | column
" | | | | | | | | | +-- current line
" | | | | | | | | +-- current % into file
" | | | | | | | +-- current syntax in
" | | | | | | | square brackets
" | | | | | | +-- current fileformat
" | | | | | +-- number of lines
" | | | | +-- preview flag in square brackets
" | | | +-- help flag in square brackets
" | | +-- readonly flag in square brackets
" | +-- rodified flag in square brackets
" +-- full path to file in the buffer
set guioptions-=m "remove menu bar
set guioptions-=T "remove toolbar
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Text Formatting/Layout
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set autoindent
" set completeopt= " don't use a pop up menu for completions
set expandtab " no real tabs please!
set formatoptions=rq " Automatically insert comment leader on return,
" and let gq format comments
set ignorecase " case insensitive by default
set infercase " case inferred by default
" set nowrap " do not wrap line
set shiftround " when at 3 spaces, and I hit > ... go to 4, not 5
set smartcase " if there are caps, go case-sensitive
set shiftwidth=4 " auto-indent amount when using cindent,
" >>, << and stuff like that
set smartindent
set softtabstop=4 " when hitting tab or backspace, how many spaces
"should a tab be (see expandtab)
set tabstop=4 " real tabs should be 8, and they will show with
" set list on
"
"" HTML (tab width 2 chr, no wrapping)
"autocmd FileType html setl sw=2
"autocmd FileType html setl ts=2
"autocmd FileType html setl sts=2
"autocmd FileType html setl textwidth=0
"" XHTML (tab width 2 chr, no wrapping)
"autocmd FileType xhtml setl sw=2
"autocmd FileType xhtml setl ts=2
"autocmd FileType xhtml setl sts=2
"autocmd FileType xhtml setl textwidth=0
"" CSS (tab width 2 chr, wrap at 79th char)
"autocmd FileType css setl sw=2
"autocmd FileType css setl ts=2
"autocmd FileType css setl sts=2
"" JS (tab width 2 chr, wrap at 79th char)
"autocmd FileType javascript setl sw=2
"autocmd FileType javascript setl ts=2
"autocmd FileType javascript setl sts=2
"" HTML DJANGO (tab width 2 chr, wrap at 79th char)
"autocmd FileType htmldjango setl sw=2
"autocmd FileType htmldjango setl ts=2
"autocmd FileType htmldjango setl sts=2
"" PYTHON (tab width 2 chr, wrap at 79th char)
""autocmd FileType python setl textwidth=79
"""" Language Specifics """
" latex
""let tlist_tex_settings='latex;b:bibitem;c:command;l:label'
" just functions and classes please
"let tlist_aspjscript_settings = 'asp;f:function;c:class'
" just functions and subs please
"let tlist_aspvbs_settings = 'asp;f:function;s:sub'
" don't show variables in freaking php
"let tlist_php_settings = 'php;c:class;d:constant;f:function'
" just functions and classes please
""let tlist_vb_settings = 'asp;f:function;c:class'
"" pvss ctl language
""let tlist_ctl_settings='ctl;f:functions'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Folding
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
set foldmethod=syntax
set foldenable
set foldlevel=100
"let g:vimsyn_folding='af'
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" File specific
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
au BufRead,BufNewFile *.py setlocal foldmethod=indent
"autocmd FileType html set ft=html.htmldjango " For SnipMate
""au BufRead,BufNewFile *.html set ft=html.htmldjango
au BufRead,BufNewFile *.html set ft=htmldjango.html.javascript
au BufNewFile,BufRead *.less set filetype=less
"au BufRead,BufNewFile *.md set filetype=markdown
au BufNewFile,BufRead SCons* set filetype=scons
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Plugin Settings/Mappings
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" scrooloose/nerdtree -- Directory tree "
"""""""""""""""""""""""""""""""""""""""""
nnoremap <F1> :NERDTreeToggle<CR>
" ervandew/supertab -- Completion "
"""""""""""""""""""""""""""""""""""
set omnifunc=syntaxcomplete#Complete
autocmd FileType python set omnifunc=pythoncomplete#Complete
autocmd FileType javascript set omnifunc=javascriptcomplete#CompleteJS
autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
autocmd FileType css set omnifunc=csscomplete#CompleteCSS
""setlocal omnifunc=pythoncomplete#Complete
""setlocal completeopt=menuone,longest,preview
""let g:SuperTabDefaultCompletionType = '<C-X><C-O>'
"set completeopt-=previewtj
"let g:SuperTabDefaultCompletionType="context"
" <Tab> open, up
" <S-Tab> down
" <C-n/p> Up/Down
" kien/ctrlp.vim "
""""""""""""""""""
let g:ctrlp_map = '<c-p>'
let g:ctrlp_cmd = 'CtrlP'
nnoremap <F2> :CtrlPBuffer<CR>
" <C-p> - search
" Press <c-f> and <c-b> to cycle between modes.
" Press <c-d> to switch to filename only search instead of full path.
" Press <c-r> to switch to regexp mode.
" Use <c-j>, <c-k> or the arrow keys to navigate the result list.
" Use <c-t> or <c-v>, <c-x> to open the selected entry in a new tab or in a new
" split.
" Use <c-n>, <c-p> to select the next/previous string in the prompt's history.
" Use <c-y> to create a new file and its parent directories.
" Use <c-z> to mark/unmark multiple files and <c-o> to open them.
" majutsushi/tagbar "
"""""""""""""""""""""
nmap <F8> :TagbarToggle<CR>
" Add support for markdown files in tagbar.
" let g:tagbar_type_mkd = {
" \ 'ctagstype': 'mkd',
" \ 'ctagsbin' : '~/.vim/bundle/markdown2ctags/markdown2ctags.py',
" \ 'ctagsargs' : '-f - --sort=yes',
" \ 'kinds' : [
" \ 's:sections',
" \ 'i:images'
" \ ],
" \ 'sro' : '|',
" \ 'kind2scope' : {
" \ 's' : 'section',
" \ },
" \ 'sort': 0,
" \ }
" Lokaltog/vim-easymotion "
"""""""""""""""""""""""""""
" <Leader><Leader>motion
" kian/rainbow_parentheses.vim "
""""""""""""""""""""""""""""""""
au FileType c,cpp,objc,objcpp call rainbow#load()
nmap <F9> :RainbowParenthesesToggle<CR>
" rstacruz/sparkup "
""""""""""""""""""""
" scrooloose/syntastic "
""""""""""""""""""""""""
nmap <F7> :SyntasticCheck<CR>
let g:syntastic_mode_map = { 'mode': 'passive',
\ 'active_filetypes': [],
\ 'passive_filetypes': [] }
" kszakmeister/vim-markdown "
"""""""""""""""""""""""""""""
let g:vim_markdown_folding_disabled=1
" ]]: go to next header.
" [[: go to previous header. Contrast with ]c.
" ][: go to next sibling header if any.
" []: go to previous sibling header if any.
" ]c: go to Current header.
" ]u: go to parent header (Up).
" julienr/vimux-pyutils "
"""""""""""""""""""""""""
" C-c will paste and execute the currently selected block in ipython
" C-b will execute the current cell in ipython A cell is similar to MATLAB's cell and is defined as the line ranging from the previous ## to the next ##
" vim-scripts/python.vim "
""""""""""""""""""""""""""
" ]t -- Jump to beginning of block
" ]e -- Jump to end of block
" ]v -- Select (Visual Line Mode) block
" ]< -- Shift block to left
" ]> -- Shift block to right
" ]# -- Comment selection
" ]u -- Uncomment selection
" ]c -- Select current/previous class
" ]d -- Select current/previous function
" ]<up> -- Jump to previous line with the same/lower indentation
" ]<down> -- Jump to next line with the same/lower indentation
" garbas/vim-snipmate honza/vim-snippets "
""""""""""""""""""""""""""""""""""""""""""
" #!
" imp
" uni
" from
" docs
" wh
" dowh
" with
" cl
" def
" deff
" defs
" property
" if
" el
" ei
" for
" cutf8
" clatin1
" cascii
" ld
" try
" ifmain
" _
" pdb
" ipdb
" pdbbb
" pudb
" pprint
" "
" a=
" test
" testcase
" fut
" getopt
" snippet glog
" le
" lg
" lw
" lc
" li
" epydoc
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Other Mappings
"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"nnoremap <F3> :!ctags -R<cr>
map <F4> :w!<CR>:!aspell check %<CR>:e! %<CR> " Spellcheck
set pastetoggle=<F6> " Paste Mode
" Toggle display of toolbars in gvim
nnoremap <C-F1> :if &go=~#'m'<Bar>set go-=m<Bar>else<Bar>set go+=m<Bar>endif<CR>
nnoremap <C-F2> :if &go=~#'T'<Bar>set go-=T<Bar>else<Bar>set go+=T<Bar>endif<CR>
nnoremap <C-F3> :if &go=~#'r'<Bar>set go-=r<Bar>else<Bar>set go+=r<Bar>endif<CR>
" pressing \<space> clears the search highlights
nmap <silent> <leader><space> :nohlsearch<CR>
" break line at cursor
nmap <silent> <leader><CR> i<CR><ESC>
" Add line before/after
nmap <silent> <leader>o o<ESC>
nmap <silent> <leader>O O<ESC>
" Copy to clipboard
noremap <leader>y "+y
noremap <leader>Y "+Y
noremap <leader>p "+p
noremap <leader>P "+P
" Moving Windows
map <c-j> <c-w>j
map <c-k> <c-w>k
map <c-l> <c-w>l
map <c-h> <c-w>h
":help key-notation
"set winaltkeys=no
" Moving Buffers
map <leader>h :bp<CR>
map <leader>l :bn<CR>
" press ; to issue commands in normal mode (no more shift holding)
nnoremap ; :
nnoremap ç :
" use jj to quickly escape to normal mode while typing
"inoremap jj <ESC>
"" When tiping and we press Shift to long
command W w
command WQ wq
command Wq wq
command Q q
" Add the virtualenv's site-packages to vim path
py << EOF
import os.path
import sys
import vim
if 'VIRTUAL_ENV' in os.environ:
project_base_dir = os.environ['VIRTUAL_ENV']
sys.path.insert(0, project_base_dir)
activate_this = os.path.join(project_base_dir, 'bin/activate_this.py')
execfile(activate_this, dict(__file__=activate_this))
EOF
" Notes
" <S-k> show manpage, python doc, etc