-
Notifications
You must be signed in to change notification settings - Fork 0
/
.vimrc
745 lines (650 loc) · 19.6 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
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
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
set nocompatible " be iMproved
filetype off " required!
set rtp+=~/.vim/bundle/vundle/
call vundle#begin()
" let Vundle manage Vundle
" required!
Plugin 'gmarik/vundle'
" My Plugin here:
"
Plugin 'Valloric/YouCompleteMe'
Plugin 'rhysd/vim-clang-format'
Plugin 'rdnetto/YCM-Generator'
Plugin 'jeaye/color_coded'
" original repos on github
Plugin 'majutsushi/tagbar'
Plugin 'altercation/vim-colors-solarized'
Plugin 'Lokaltog/vim-easymotion'
Plugin 'Lokaltog/vim-powerline'
Plugin 'nvie/vim-flake8'
Plugin 'walm/jshint.vim'
Plugin 'scrooloose/nerdcommenter'
Plugin 'scrooloose/nerdtree'
Plugin 'scrooloose/syntastic'
Plugin 'tpope/vim-repeat'
Plugin 'tpope/vim-surround'
Plugin 'tpope/vim-markdown'
Plugin 'godlygeek/tabular'
Plugin 'chreekat/vim-paren-crosshairs'
Plugin 'kien/ctrlp.vim'
Plugin 'Raimondi/delimitMate'
Plugin 'fholgado/minibufexpl.vim'
source ~/.vim/vimrc_ycm
" Github repos of the user 'vim-scripts'
" => can omit the username part
call vundle#end()
filetype plugin indent on
" required!
"se shiftwidth=4
"se sts=4
se modelines=2
se modeline
se nocp
se mouse=a
if has("autocmd")
filetype on
filetype indent on
filetype plugin on
endif
" Turbo-charge EasyMotion
"let mapleader = " "
"
" Stop moving the cursor to the beginning of the line - for many commands
"
set nostartofline
"
" Very efficient moves amongst lines
"
set relativenumber
"
" maps NERDTree to F10
"
noremap <silent> <F10> :NERDTreeToggle<CR>
noremap! <silent> <F10> <ESC>:NERDTreeToggle<CR>
"
" tells NERDTree to use ASCII chars
" and to ignore some files
"
let g:NERDTreeDirArrows=0
let g:NERDTreeIgnore=['\.pyc$', '\.o$']
"
" Better TAB completion for files (like the shell)
"
if has("wildmenu")
set wildmenu
set wildmode=longest,list
" Ignore stuff (for TAB autocompletion)
set wildignore+=*.a,*.o
set wildignore+=*.bmp,*.gif,*.ico,*.jpg,*.png
set wildignore+=.DS_Store,.git,.hg,.svn
set wildignore+=*~,*.swp,*.tmp
endif
"
" My attempt at easy navigation/creation of windows:
" Ctrl-Cursor keys to navigate open windows
" Ctrl-F12 to close current window
" Also...
" F4 to navigate to next compile/link/flake8 error
" F3 to navigate to next Syntastic error (first, invoke :Errors)
"
function! WinMove(key)
let t:curwin = winnr()
exec "wincmd ".a:key
" if (t:curwin == winnr())
" " we havent moved
" " Create window in that direction,
" if (match(a:key,'[jk]')) "were we going up/down
" wincmd v
" else
" wincmd s
" endif
" exec "wincmd ".a:key
" endif
endfunction
function! WinClose()
if &filetype == "man"
bd!
else
bd
endif
endfunction
if !has("gui_running")
" XTerm
noremap <silent> <Esc>[1;5B :call WinMove('j')<CR>
noremap <silent> <Esc>[1;5A :call WinMove('k')<CR>
noremap <silent> <Esc>[1;5D :call WinMove('h')<CR>
noremap <silent> <Esc>[1;5C :call WinMove('l')<CR>
noremap <silent> <Esc>[24;5~ :call WinClose()<CR>
noremap! <silent> <Esc>[1;5B <ESC>:call WinMove('j')<CR>
noremap! <silent> <Esc>[1;5A <ESC>:call WinMove('k')<CR>
noremap! <silent> <Esc>[1;5D <ESC>:call WinMove('h')<CR>
noremap! <silent> <Esc>[1;5C <ESC>:call WinMove('l')<CR>
noremap! <silent> <Esc>[24;5~ <ESC>:call WinClose()<CR>
noremap <silent> <Esc>OS :cn<CR>
noremap! <silent> <Esc>OS <ESC>:cn<CR>
noremap <silent> <Esc>OR :lnext<CR>
noremap! <silent> <Esc>OR <ESC>:lnext<CR>
" Putty-ing from Windows
if has("unix")
let myosuname = system("uname")
if myosuname =~ "OpenBSD"
" Putty-ing from Windows into OpenBSD
noremap <silent> <Esc>[B :call WinMove('j')<CR>
noremap <silent> <Esc>[A :call WinMove('k')<CR>
noremap <silent> <Esc>[D :call WinMove('h')<CR>
noremap <silent> <Esc>[C :call WinMove('l')<CR>
noremap <silent> <Esc>[24~ :call WinClose()<CR>
noremap! <silent> <Esc>[B <ESC>:call WinMove('j')<CR>
noremap! <silent> <Esc>[A <ESC>:call WinMove('k')<CR>
noremap! <silent> <Esc>[D <ESC>:call WinMove('h')<CR>
noremap! <silent> <Esc>[C <ESC>:call WinMove('l')<CR>
noremap! <silent> <Esc>[24~ <ESC>:call WinClose()<CR>
noremap <silent> <Esc>[14~ :cn<CR>
noremap! <silent> <Esc>[14~ <ESC>:cn<CR>
elseif &term == "xterm-color"
" Putty-ing from Windows into Linux
noremap <silent> <Esc>OB :call WinMove('j')<CR>
noremap <silent> <Esc>OA :call WinMove('k')<CR>
noremap <silent> <Esc>OD :call WinMove('h')<CR>
noremap <silent> <Esc>OC :call WinMove('l')<CR>
noremap <silent> <Esc>[24~ :call WinClose()<CR>
noremap! <silent> <Esc>OB <ESC>:call WinMove('j')<CR>
noremap! <silent> <Esc>OA <ESC>:call WinMove('k')<CR>
noremap! <silent> <Esc>OD <ESC>:call WinMove('h')<CR>
noremap! <silent> <Esc>OC <ESC>:call WinMove('l')<CR>
noremap! <silent> <Esc>[24~ <ESC>:call WinClose()<CR>
noremap <silent> <Esc>[14~ :cn<CR>
noremap! <silent> <Esc>[14~ <ESC>:cn<CR>
endif
endif
else
" GVim
noremap <silent> <C-Down> :call WinMove('j')<CR>
noremap <silent> <C-Up> :call WinMove('k')<CR>
noremap <silent> <C-Left> :call WinMove('h')<CR>
noremap <silent> <C-Right> :call WinMove('l')<CR>
noremap <silent> <C-F12> :call WinClose()<CR>
noremap! <silent> <C-Down> <ESC>:call WinMove('j')<CR>
noremap! <silent> <C-Up> <ESC>:call WinMove('k')<CR>
noremap! <silent> <C-Left> <ESC>:call WinMove('h')<CR>
noremap! <silent> <C-Right> <ESC>:call WinMove('l')<CR>
noremap! <silent> <C-F12> <ESC>:call WinClose()<CR>
noremap <silent> <F4> :cn<CR>
noremap! <silent> <F4> <ESC>:cn<CR>
noremap <silent> <F3> :ln<CR>
noremap! <silent> <F3> <ESC>:ln<CR>
endif
"
" In cmd mode, + and - vertically enlarge/shrink a split
"
"noremap <silent> = :call WinMove('+')<CR>
"noremap <silent> - :call WinMove('-')<CR>
"noremap <silent> + :call WinMove('>')<CR>
"noremap <silent> _ :call WinMove('<')<CR>
"
" incremental search that highlights results
"
set incsearch
set hlsearch
" Ctrl-L clears the highlight from the last search
noremap <C-l> :nohlsearch<CR><C-l>
noremap! <C-l> <ESC>:nohlsearch<CR><C-l>
"
" Fix insert-mode cursor keys in FreeBSD
"
if has("unix")
let myosuname = system("uname")
if myosuname =~ "FreeBSD"
set term=cons25
endif
endif
"
" Reselect visual block after indenting
"
vnoremap < <gv
vnoremap > >gv
"
" Keep search pattern at the center of the screen
"
"nnoremap <silent> n nzz
"nnoremap <silent> N Nzz
"nnoremap <silent> * *zz
"nnoremap <silent> # #zz
"
" Syntastic - Ignore 'too long lines' from flake8 report
"
"let g:syntastic_python_checker_args = "--ignore=E501,E225"
"
"when the vim window is resized resize the vsplit panes as well
"
au VimResized * exe "normal! \<c-w>="
"
" TAB and Shift-TAB in normal mode cycle buffers
"
noremap <Tab> :bn<CR>
noremap <S-Tab> :bp<CR>
"
" Syntax-coloring of files
"
syntax on
"
" Disable cursors (force myself to learn VI moves)
" Months later: It worked - I now only use the home row.
" Leaving it here for any one else needing it.
"
map <down> <nop>
map <left> <nop>
map <right> <nop>
map <up> <nop>
"
"imap <down> <nop>
"imap <left> <nop>
"imap <right> <nop>
"imap <up> <nop>
"
" highlight current line
"
set cursorline
"
" always show the status line
"
set laststatus=2
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
"
" But we must be able to hide them if we want to
"
function! TabsAndColumn80AndNumbers ()
"
" tabs must be visible
"
set list!
if (&relativenumber == 1)
set number!
else
set relativenumber!
endif
set listchars=tab:>-,trail:-
if exists('+colorcolumn')
"
" Show me column 80
"
if &colorcolumn == ""
set colorcolumn=80
else
set colorcolumn=
endif
endif
endfunction
nnoremap <Esc>[20~ :call TabsAndColumn80AndNumbers()<CR>
nnoremap <F9> :call TabsAndColumn80AndNumbers()<CR>
"
" Smart backspace
"
set backspace=start,indent,eol
"
" Avoid TABs like the plague
"
set expandtab
"
" Much improved auto completion menus
"
set completeopt=menuone,longest,preview
"
" Use C-space for omni completion in insert mode.
" Disabled currently, because I am testing the
" 'YouCompleteMe' plugin...
"
"inoremap <expr> <C-Space> pumvisible() \|\| &omnifunc == '' ?
" \ "\<lt>C-n>" :
" \ "\<lt>C-x>\<lt>C-o><c-r>=pumvisible() ?" .
" \ "\"\\<lt>c-n>\\<lt>c-p>\\<lt>c-n>\" :" .
" \ "\" \\<lt>bs>\\<lt>C-n>\"\<CR>"
"imap <C-@> <C-Space>
"
" Stop warning me about leaving a modified buffer
"
set hidden
"
" Show command as I type it
"
set showcmd
"
" Now that I use vim-paren-crosshairs, I need 256 colors in my console VIM
"
set t_Co=256
"
" After 'f' in normal mode, I always mistype 'search next' - use space for ;
"
noremap <space> ;
"
" Manpage for word under cursor via 'K' in command mode
"
runtime ftplugin/man.vim
noremap <buffer> <silent> K :exe "Man" expand('<cword>') <CR>
"
" Map SyntasticCheck to F6
"
noremap <silent> <F6> :SyntasticCheck<CR>
noremap! <silent> <F6> <ESC>:SyntasticCheck<CR>
let g:syntastic_mode_map = {
\ 'mode': 'active',
\ 'active_filetypes': [],
\ 'passive_filetypes': ['python', 'cpp', 'c', 'typescript'] }
"
" Now that I use the CtrlP plugin, a very useful shortcut is to open
" an XTerm in the folder of the currently opened file:
"
noremap <silent> <F2> :!xterm -e "cd %:p:h ; bash" &<CR><CR>
noremap <silent> <Esc>OQ :!xterm -e "cd %:p:h ; bash" &<CR><CR>
let g:ctrlp_working_path_mode = 0
" Unfortunately, reusing the cache caused more harm than good
" let g:ctrlp_clear_cache_on_exit = 1
"
" Powerline settings
"
let g:Powerline_stl_path_style = 'short'
"
" Language-specific section
"
"
" For C and C++
"
" libclang use is mandatory now
"
let g:clang_use_library = 1
" Cover CUDA .cu, too)
au BufNewFile,BufRead *.c,*.cc,*.cpp,*.h,*.cu call SetupCandCPPenviron()
function! SetupCandCPPenviron()
"
" Search path for 'gf' command (e.g. open #include-d files)
"
"set path+=/usr/include/c++/**
"
" Tags
"
" If I ever need to generate tags on the fly, I uncomment this:
" noremap <C-F11> :!ctags -R --c++-kinds=+p --fields=+iaS --extra=+q .<CR>
set tags+=/usr/include/tags
"
" Toggle TagList window with F8
"
noremap <buffer> <silent> <F8> :TlistToggle<CR>
noremap! <buffer> <silent> <F8> <ESC>:TlistToggle<CR>
let g:Tlist_Use_Right_Window = 1
"
" Especially for C and C++, use section 3 of the manpages
"
noremap <buffer> <silent> K :exe "Man" 3 expand('<cword>') <CR>
"
" Remap F7 to make
"
noremap <buffer> <special> <F7> :make<CR>
noremap! <buffer> <special> <F7> <ESC>:make<CR>
endfunction
"
" For Python
"
au BufNewFile,BufRead *.py call SetupPythonEnviron()
function! SetupPythonEnviron()
"
" flake8: ignore 'too long lines'
"
"let g:flake8_ignore="E501,E225"
"
" Function that sends individual Python classes or Python functions
" to active screen (SLIME emulation)
"
function! SelectClassOrFunction ()
let s:currLine = getline(line('.'))
if s:currLine =~ '^def\|^class'
" If the cursor line is a function/class start line,
" save its number
let s:beginLineNumber = line('.')
elseif s:currLine =~ '^[a-zA-Z]'
" If the cursor line begins with something else,
" we must be on something like a global assignment
let s:beginLineNumber = line('.')
let s:endLineNumber = line('.')
:exe ":" . s:beginLineNumber . "," . s:endLineNumber . "y r"
:call Send_to_Screen(@r)
return
else
" we are inside something, so search backwards
" for function/class beginning, and save its number
let s:beginLineNumber = search('^def\|^class', 'bnW')
if !s:beginLineNumber
let s:beginLineNumber = 1
endif
endif
" Now search for the first line that starts with something
" (function, class, global, etc) and save it
let s:endLineNumber = search('^[a-zA-Z@]', 'nW')
if !s:endLineNumber
let s:endLineNumber = line('$')
else
let s:endLineNumber = s:endLineNumber-1
endif
" Finally pass the range to the screen session running a REPL
:exe ":" . s:beginLineNumber . "," . s:endLineNumber . "y r"
:call Send_to_Screen(@r)
endfunction
noremap <buffer> <silent> <C-c><C-c> :call SelectClassOrFunction()<CR><CR>
"
" Flake8 is always at F7 - but syntastic must use pylint
"
let g:syntastic_python_checker = 'pylint'
endfunction
"
" OCaml
"
au BufNewFile,BufRead *.ml call SetupOCamlEnviron()
function! SetupOCamlEnviron()
"
" Remap F7 to make if the file is an .ml one
"
noremap <buffer> <special> <F7> :make<CR>
noremap! <buffer> <special> <F7> <ESC>:make<CR>
endfunction
"
" Javascript
"
au BufNewFile,BufRead *.js call SetupJSEnviron()
function! SetupJSEnviron()
"
" Remap F7 to JSHint if the file is a .js one
"
noremap <buffer> <special> <F7> :JSHint<CR>
noremap! <buffer> <special> <F7> <ESC>:JSHint<CR>
let g:syntastic_javascript_syntax_checker="jshint"
endfunction
au BufNewFile,BufRead *.md call SetupMDEnviron()
function! SetupMDEnviron()
"
" Remap F7 to make
"
noremap <buffer> <special> <F7> :make<CR>
noremap! <buffer> <special> <F7> <ESC>:make<CR>
endfunction
au BufNewFile,BufRead *.tex call SetupTexEnviron()
function! SetupTexEnviron()
"
" Remap F7 to make
"
noremap <buffer> <special> <F7> :make<CR>
noremap! <buffer> <special> <F7> <ESC>:make<CR>
endfunction
au BufNewFile,BufRead *.htm,*.html call SetupHTMLenviron()
function! SetupHTMLenviron()
"
" I use custom Makefiles that do many things
" (tidy checks, etc)
"
noremap <buffer> <special> <F7> :make<CR>
noremap! <buffer> <special> <F7> <ESC>:make<CR>
endfunction
"
" XML (Read the related blog post at http://ttsiodras.github.io/regexp.html)
"
" Use SAXCount to validate XMLs based on their .xsds ; provided that is,
" that they have header lines on their top - indicating what .xsd they use.
" e.g. files looking like this:
"
" <?xml version="1.0" encoding="utf-8" ?>
" <WhateverElement ...
" xsi:noNamespaceSchemaLocation="something.xsd"
" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
" <AnotherElement>
" ...
" </AnotherElement>
" </WhateverElement>
"
" The .xsd file must be at the same place as the .xml - or a "search"
" functionality must be added to SAXCount - some sort of XSDPATH.
"
" Now for the ":make" (mapped to F7) and error parsing functionality:
"
" No need to explain this part:
"
" se makeprg=SAXCount\ -n\ -s\ -f\ %
"
" But this needs explaining:
"
" se errorformat=%E,%C%.%#Error\ at\ file\ %f%.\ line\ %l%.\ char\ %c,%C\ \ Message:\ %m,%Z,%-G%f:\ %*[0-9]\ ms\ %.%#
"
" It is supposed to catch error messages like these:
"
" $ SAXCount -n -s -f a.xml
"
" Error at file /var/tmp/a.xml, line 4, char 23
" Message: empty content is not valid for content model '(transferBatch|notification)'
"
" ... or Fatal errors, that similarly begin with "Fatal Error" instead of "Error":
"
" Fatal Error at file ...
"
" It must also ignore lines like these:
"
" a.xml: 11 ms (64 elems, 207 attrs, 1133 spaces, 0 chars)
"
" So, breaking it down, I have two errorformat "rules":
"
" se errorformat=
" (Error report span in multiple lines, begins with %E, ends with %Z)
" %E,%C%.%#Error\ at\ file\ %f%.\ line\ %l%.\ char\ %c,%C\ \ Message:\ %m,%Z,
" (Information emitted by SAXCount about execution time)
" %-G%f:\ %*[0-9]\ ms\ %.%#
"
" The first rule:
"
" %E (begin multiline match of an error report)
" , (end of first line, which is always empty)
" %C (continuation - next line)
" %.%#Error...
" (which means match '.*Error...' - so it also catches "Fatal Error...")
" %f%.
" (filename, followed by any char - in this case, the comma,
" for some reason I could not use '\,' so I just used a '%.')
" %l and %c (similarly, line and column number)
" %C (continuation - next line)
" Message: %m
" (matches the actual message for the copen list)
" %Z (end multiline match)
"
" The second rule: ignore (hence the minus in %-G) this kind of informational lines:
" "a.xml: 11 ms (64 elems, 207 attrs, 1133 spaces, 0 chars)"
"
" %-G%f:\ %*[0-9]\ ms\ %.%#
" (basically: filename, colon, space, numbers, space, "ms", and ".*")
"
" Now all I have to do to validate my .xml files is hit F7, and navigate from
" each error to the next with F4 (just as I do for my Python work, via pyflakes).
"
au BufNewFile,BufRead *.xml call SetupXMLEnviron()
function! SetupXMLEnviron()
se errorformat=%E,%C%.%#Error\ at\ file\ %f%.\ line\ %l%.\ char\ %c,%C\ \ Message:\ %m,%Z,%-G%f:\ %*[0-9]\ ms\ %.%#
se makeprg=SAXCount\ -n\ -s\ -f\ %
noremap <buffer> <F7> :make<CR>
noremap! <buffer> <F7> :make<CR>
" In visual mode (with multiple lines selected) use Leader followed by '='
" to align attribute assignments so that they line up horizontally
" vmap <buffer> <Leader>= :s,\v\s*(\w+)\s*\=\s*,@\1=,g<CR>gv:!column -t -s @<CR>
vmap <buffer> <Leader>= :Tabularize/\v\zs\w+\ze\=["']/l1l0<CR>
endfunction
" show tabs normally as 4 spaces
set tabstop=2 shiftwidth=2 "no expandtab
set listchars=tab:>-
set list
" use spelling in English when typing set spell with own dictionary
set spellfile=~/.vim/spellfile.add
set spelllang=en_us
" use auto indentation
set autoindent
set smartindent
" line numbers
set number
" change dir to pwd in gvim
set autochdir
" expand tabs in c/cpp files
autocmd FileType c,cpp setlocal shiftwidth=2 softtabstop=2 expandtab
autocmd FileType sh setlocal shiftwidth=2 tabstop=2 expandtab
autocmd FileType tex setlocal shiftwidth=2 tabstop=2 expandtab
" make
map <F12> :make<CR>
" Tell vim to remember certain things when we exit
" '10 : marks will be remembered for up to 10 previously edited files
" "100 : will save up to 100 lines for each register
" :20 : up to 20 lines of command-line history will be remembered
" % : saves and restores the buffer list
" n... : where to save the viminfo files
set viminfo='10,\"400,:20,%,n~/.viminfo
function! ResCur()
if line("'\"") <= line("$")
normal! g`"
return 1
endif
endfunction
augroup resCur
autocmd!
autocmd BufWinEnter * call ResCur()
augroup END
" gvim
set background=dark
set guioptions-=T
if has("gui_running")
colorscheme solarized
if has("gui_gtk2")
set guifont=Inconsolata\ 10
elseif has("gui_macvim")
set guifont=Menlo\ Regular:h14
elseif has("gui_win32")
set guifont=Consolas:h11:cANSI
endif
else
colorscheme torte
endif
"
" For GVIM only
"
if has("gui_running")
" Horizontal scrollbar
set guioptions+=b
set nowrap
" set guifont=Lucida\ Console\ Semi-Condensed\ 11
" colorscheme evening
endif
"Eigene =)
noremap <F2> :TlistToggle<CR>