-
Notifications
You must be signed in to change notification settings - Fork 8
/
vimrc
108 lines (88 loc) · 2.79 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
set ruler
set expandtab shiftwidth=4 tabstop=4 softtabstop=4
set wildmenu wildmode=longest:full,full
set incsearch nohlsearch
set hidden
set mouse=a
set laststatus=2
set showcmd
let g:full_name="Maxime Coste"
set title
set encoding=utf-8
set termencoding=utf-8
filetype plugin indent on
syntax on
" use tagjump behaviour by default
nnoremap <C-]> g<C-]>
nnoremap <C-W><C-]> <C-W>g<C-]>
nnoremap <C-W>] <C-W>g]
" reload vimrc when modified
autocmd! BufWritePost .vimrc source %
" C/C++ Options
autocmd FileType c\|cpp setlocal cindent
set cinoptions=:0,g0,(0,w0,Ws
let g:clang_complete_auto = 0
function! InsertGuards()
let define = substitute(substitute(expand('%'), "^.*/", "", ""), "[-\\/. ]", "_", "g") . "_INCLUDED"
call append(0, [ "#ifndef " . define, "#define " . define, ])
call append(line("$"), "#endif // " . define)
if line("$") == 3
call append(2, "")
call cursor(3, 0)
endif
endfunction
augroup Cpp
autocmd!
autocmd FileType cpp syn keyword cppKeywords2 override sealed offsetof
\ foreach foreachconst foreachitem foreachitemconst
autocmd FileType cpp hi link cppKeywords2 Keyword
autocmd BufNewFile *.{h,hh,hpp} call InsertGuards()
augroup end
" connect to cscope.out if possible
if filereadable("cscope.out")
cscope add cscope.out
endif
" Background make
command! -nargs=* BgMake
\ silent execute ":!(make " . "<args>" . " > /tmp/make.output 2>&1;"
\ "notify-send 'make finished' 'make <args> finished') &" |
\ redraw! |
\ cfile /tmp/make.output | copen
" Mr Proper stuffs
augroup Whitespace
autocmd!
autocmd Syntax * syn match TrailingWhitespace /\s\+$/
autocmd Syntax * hi link TrailingWhitespace Error
augroup end
function! FixBlanks()
%s/\s\+$//
retab
endfunction
command! FixBlanks call FixBlanks()
" Eugen Systems stuff
augroup Eugen
autocmd!
autocmd VimEnter * if match(getcwd(), "slayer") != -1 |
\set tags+=datatags |
\endif
autocmd VimEnter * if match(getcwd(), "slayer") != -1 |
autocmd BufNewFile *.cpp if match(getcwd(), "slayer") != -1 |
\call append(0, [ "#include \"StdAfx.h\"", "", "#include \"" . fnamemodify(expand('%'), ":t:r") . ".h\"", "", "namespace Eugen", "{", "}" ]) |
\endif
augroup end
augroup ZippedDocs
autocmd!
autocmd BufReadCmd *.docx,*.xlsx,*.pptx call zip#Browse(expand("<amatch>"))
autocmd BufReadCmd *.odt,*.ott,*.ods,*.ots,*.odp,*.otp,*.odg,*.otg call zip#Browse(expand("<amatch>"))
augroup end
" AutoComplPop
let g:acp_enableAtStartup = 1
let g:acp_ignorecaseOption=0
" man support
runtime ftplugin/man.vim
nnoremap K :Man <C-R><C-W><CR>
" alternate
let g:alternateSearchPath = 'sfr:../Sources,sfr:../Headers'
let g:alternateNoDefaultAlternate = 1
let g:alternateRelativeFiles = 1
colorscheme wombat256