summaryrefslogtreecommitdiff
path: root/gvimrc
blob: 798cc5cd7a3eb859d870c42de76ce3c6d2873a26 (plain)
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
colors darkblue
set number
set numberwidth=4
set columns=140
set lines=72
set hlsearch
set guifont=Hack\ 8
set tabstop=2
set shiftwidth=2
set wrap
set linebreak
set cindent cino=j1
set ic
set makeprg=b2
set incsearch
set smartcase
set diffopt+=iwhite
set backupdir=/tmp
set directory=/tmp
set undodir=/tmp
set spelllang=en
set nospell
tmenu ToolBar.Make Write all and make
amenu ToolBar.Make :wa\|mak
au BufRead,BufNewFile *.ll set filetype=lex
au BufRead,BufNewFile *.jam set filetype=jam
map <F2> :cl<CR>
map <S-F2> :cl!<CR>
map <F3> :call GitDiffDir()<CR><CR>
map <C-S-F3> :call GitDiffCDir()<CR><CR>
set diffexpr=MyDiff()
map <S-F3> :VCSVimDiff<CR>
au FileType html setlocal equalprg=tidy\ -qi\ w\ 200\ --tidy-mark\ false
au FileType xml,xslt setlocal equalprg=xmllint\ --format\ --recover\ -
au FileType json setlocal equalprg=python\ -m\ json.tool
au FileType c,cpp,h map <F4> :A<CR>
au FileType c,cpp,h map <S-F4> :AS<CR>
au FileType c,cpp,jam,h,slice map <F5> :wa<CR>:set makeprg=b2\ -qj3<CR>:mak<CR>
au FileType c,cpp,jam,h,slice map <C-F5> :wa<CR>:set makeprg=b2\ -qj3\ pch=off<CR>:mak<CR>
au FileType c,cpp,jam,h,slice map <S-F5> :wa<CR>:set makeprg=b2\ -qj3\ variant=release<CR>:mak<CR>
au FileType c,cpp,jam,h,slice map <F6> :wa<CR>:set makeprg=b2\ -q<CR>:mak<CR>
au FileType c,cpp,h map <S-F9> :call LoadCov()<CR><CR>
au FileType c,cpp,h map <S-F> :YcmCompleter FixIt<CR>
au FileType c,cpp,h map <C-]> :YcmCompleter GoToDefinition<CR>
au FileType c,cpp,h map <C-S-]> :YcmCompleter GoToDeclaration<CR>
au FileType dot map <F5> :wa<CR>:set makeprg=dot\ %\ -Tpng\ -O<CR>:mak<CR><CR>
au FileType cpp,h map <S-F12> :wa<CR>:set makeprg=doxygen<CR>:mak<CR><CR>
au FileType ebuild map <F6> :w<CR>:!ebuild % manifest<CR>
au FileType ebuild map <F7> :w<CR>:!ebuild % clean<CR>
au FileType ebuild map <F8> :w<CR>:!ebuild % compile<CR>
au FileType ebuild map <F9> :w<CR>:!ebuild % install<CR>
au FileType ebuild map <F9> :w<CR>:!ebuild % test<CR>
au FileType ebuild map <S-F7> :w<CR>:!ebuild % manifest clean<CR>
au FileType ebuild map <S-F8> :w<CR>:!ebuild % manifest clean compile<CR>
au FileType ebuild map <S-F9> :w<CR>:!ebuild % manifest clean compile install<CR>
au FileType ebuild map <S-F9> :w<CR>:!ebuild % manifest clean compile test<CR>
au FileType ebuild map <C-S-F10> :w<CR>:!sudo ebuild % merge<CR>
au FileType groovy setlocal foldmethod=marker foldmarker={,}
au FileType gitcommit setlocal spell
map <F7> :lfir<CR>zz<CR>k
map <S-F7> :lnext<CR>zz<CR>k
map <C-S-F7> :lnext<CR>zz<CR>k
map <F8> :cn<CR>
map <S-F8> :cN<CR>
map <F9> gg=G
map <C-S-S> :GitGutterStageHunk<CR>
map <C-L> zl
map <C-H> zh
map <F11> :YcmForceCompileAndDiagnostics<CR>
map <C-N> :NERDTree<CR>
map <C-C> <PLUG>NERDCommenterToggle<CR>
set wildmode=longest:full
set wildmenu
set autoread
set enc=utf8
set foldenable
set foldmethod=syntax
set foldcolumn=4
set foldlevel=100

function! LoadCov()
	execute "!(cd /tmp && find ". expand("%:p:h") ." -name *.o -path */coverage/* | xargs gcov -r -p > /dev/null)"
	let path = "/tmp/".substitute(@%, "/", "\\\\\\\#", "g").".gcov"
	echo path
	execute ":GcovLoad ".path
endfunction
function! SvnDiffDir()
	let output = substitute(system('pwd | md5sum | cut -b-32'), "\n", "", "")
	let path = "/tmp/svndiff-".output.".patch"
	execute "!svn diff --force --no-diff-deleted -x -b > ".path
	execute "!dos2unix ".path
	execute "e ".path
endfunction
function! HgDiffDir()
	let output = substitute(system('pwd | md5sum | cut -b-32'), "\n", "", "")
	let path = "/tmp/hgdiff-".output.".patch"
	execute "!hg diff -p -b > ".path
	execute "!dos2unix ".path
	execute "e ".path
endfunction
function! GitDiffDir()
	let output = substitute(system('pwd | md5sum | cut -b-32'), "\n", "", "")
	let path = "/tmp/gitdiff-".output.".patch"
	execute "!git diff --no-prefix --relative -b -M > ".path
	execute "!dos2unix ".path
	execute "e ".path
endfunction
function! GitDiffCDir()
	let output = substitute(system('pwd | md5sum | cut -b-32'), "\n", "", "")
	let path = "/tmp/gitdiffc-".output.".patch"
	execute "!git diff --no-prefix --cached --relative -b -M > ".path
	execute "!dos2unix ".path
	execute "e ".path
endfunction
function! MyDiff()
	 let opt = ""
	 if &diffopt =~ "icase"
		 let opt = opt . "-i "
	 endif
	 if &diffopt =~ "iwhite"
		 let opt = opt . "-b "
	 endif
	 silent execute "!diff -ad --binary " . opt . v:fname_in . " " . v:fname_new .
	\  " > " . v:fname_out
endfunction

let g:ycm_extra_conf_globlist = ['~/*','!~/*']
let g:ycm_register_as_syntastic_checker = 1
let g:ycm_always_populate_location_list = 1
let g:ycm_autoclose_preview_window_after_insertion = 0
let g:ycm_show_diagnostics_ui = 1
let g:ycm_error_symbol = '✗'
let g:ycm_warning_symbol = '⚠'
let g:ycm_enable_diagnostic_signs = 1
let g:ycm_enable_diagnostic_highlighting = 1
let g:ycm_echo_current_diagnostic = 1
let g:ycm_open_loclist_on_ycm_diags = 1
let g:ycm_server_python_interpreter = "/usr/bin/python3.6"
let g:syntastic_always_populate_loc_list = 1
let g:gitgutter_diff_args = '-b'

:highlight ExtraWhitespace ctermbg=red guibg=red
:match ExtraWhitespace /\s\+$\| \+\ze\t|^\t*\zs \+/