1 " Purpose: My personal .vimrc
4 "profile start /tmp/profile.log
12 set backspace=indent,eol,start
15 set grepprg=grep\ -nH\ $*
24 set listchars=tab:»,trail:·,eol:$
33 set spelllang=de_at,en
38 set wildmode=longest,list:longest
42 " Pathogen runtime path manipulation
43 "call pathogen#infect() "Using the infect method breaks ft detection
45 call pathogen#runtime_append_all_bundles()
46 call pathogen#helptags()
49 filetype plugin indent on
52 "Power saving tip: powertop-homepage
53 let &guicursor = &guicursor . ",a:blinkon0"
54 "According to vim help -- enable mouse in xterm...
59 let g:CSApprox_attr_map = { 'bold' : 'bold', 'italic' : 'underline', 'sp' : 'bg' }
60 colorscheme shuber-wombat
63 " Use the below highlight group when displaying bad whitespace is desired.
64 highlight BadWhitespace ctermbg=red guibg=red
65 " Make trailing whitespace be flagged as bad.
66 au Filetype python,tex,c,cpp,cs,objc,java,vim syn match BadWhitespace /\s\+$/ containedin=ALL
67 au Filetype python,tex,c,cpp,cs,objc,java,vim let g:airline#extensions#whitespace#enabled = 0
70 " Detect indentation, but otherwise set expandtab
71 if exists(":DetectIndent")
72 au BufReadPost * :DetectIndent
76 let g:syntastic_mode_map = { 'mode' : 'active', 'active_filetypes' : [], 'passive_filetypes' : ['html'] }
79 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
81 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
83 let g:airline_powerline_fonts = 0
84 let g:airline_theme = 'wombat'
86 let g:airline#extensions#tabline#enabled = 1
87 let g:airline#extensions#tagbar#enabled = 0
88 let g:airline#extensions#whitespace#enabled = 0
89 let g:airline#extensions#branch#enabled = 0
90 let g:airline#extensions#branch#use_vcscommand = 1
92 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
94 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
96 "Open current file with a specific program
98 execute ":!" . a:prog . " % &"
102 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
104 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
106 nmap <s-PageDown> :bn<CR>
107 nmap <s-PageUp> :bp<CR>
109 map <a-c> <plug>NERDCommenterToggle
110 nmap <F9> :NERDTreeToggle<CR>
111 nmap <F10> :TagbarToggle<CR>
115 vmap <c-s> <Esc><c-s>gv
116 imap <c-s> <c-o><c-s>
119 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
121 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
123 "let fortran_free_source=1
124 au BufNewFile *.f90 set fortran_free_source=1
125 au Filetype fortran set cindent cst csto=0
128 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
129 " C, C++, C#, objc, java
130 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
132 au Filetype c,cpp,cs,objc,java map <F4> :cnext <CR>
133 au Filetype c,cpp,cs,objc,java map <S-F4> :cprevious <CR>
134 au Filetype c,cpp,cs,objc,java map <F11> :AS <CR>
135 au Filetype c,cpp,cs,objc,java map <S-F11> :A <CR>
136 au Filetype c,cpp,cs,objc,java set cindent cst csto=0
137 au Filetype c,cpp,cs,objc map <F7> :make <CR>
138 au Filetype java map <F7> :!ant -f ../build.xml <CR>
139 au Filetype c,cpp,cs,objc set makeprg=make
142 "Prepend the namespace to an identifier, e.g. 'std::' before 'map' excluding
143 "those in C/C++ comments.
144 function PrependCppNamespaceToIdent(ns, id)
146 " To match Not to match
150 "|/* */ /* */ id |/* */ // id
158 " In order to not match '* id' it is assumed that multi-line comment lines
159 " in the middle begin with a star.
161 " If #include and // and /* and ^* and :: is not prepend:
162 execute ':%s@\(\(#include\|\/\/\|\/\*\|^\s*\*[^/]\).*\|::\)\@<!\<' . a:id . '\>@' . a:ns . '::' . a:id . '@ge'
163 " If #include and // and :: is not prepend, but */ is, and no further /* or // are found
164 execute ':%s@\(\(#include\|\/\/\).*\)\@<!\*\/\(\/[^\/\*]\|[^\/]\)*\zs\(::\)\@<!\<' . a:id . '\>@' . a:ns . '::' . a:id . '@ge'
168 "Prepend STL namespace 'std::' to several identifiers
169 function PrependSTLNamespace()
170 " This list of identifier is not complete, but adding all of them is too
171 " much. We rather like to add identifieres that are 'typical' for C++.
172 " Others, like 'move' are likely to not be C++ specific. In this cases the
173 " user is asked to call PrependCppNamespaceToIdent by hand.
175 let id = id +['cin', 'cout', 'cerr', 'endl']
176 let id = id +['swap', 'sort', 'max', 'min']
177 let id = id +['vector', 'deque', 'list', 'map', 'multimap', 'set']
178 let id = id +['queue', 'stack', 'priority_queue']
179 let id = id +['ostream', 'istream', 'sstream']
180 let id = id +['pair', 'string']
183 call PrependCppNamespaceToIdent("std", i)
187 function EscapeHexToChar()
188 echo 'Call "x/Nxb addr" in GDB to print N bytes at addr'
190 execute '%s/\s*0x\(\x\x\)/\\x\1/g'
191 execute '%s/^\(.*\)$/"\1"/'
194 function InsertIncludeGuardsWithoutEndif()
195 let gatename = substitute(expand("%:t"), "\\.", "_", "g") . '_' . strpart(system('pwgen -c 16 1'), 0, 16)
196 execute "normal! i#ifndef " . gatename
197 execute "normal! o#define " . gatename
200 function AddIncludeGuards()
201 execute "normal! Go#endif"
203 call InsertIncludeGuardsWithoutEndif()
206 autocmd BufNewFile *.{h,hpp,hxx} call AddIncludeGuards()
209 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
211 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
213 au Filetype text set textwidth=80
214 au Filetype markddown set textwidth=80
215 "According to thunderbirds settings
216 au Filetype mail set textwidth=72
217 au Filetype mail set expandtab
219 "a and w reformat the paragraph automatically and a new paragraph
220 "is indicated by lines not ending with white-space
222 au Filetype mail,text set fo+=n spell
226 au Filetype mail syn match Statement /^\s*-*\s*>8\s*-*\s*$/
227 au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/
230 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
232 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
234 "au Filetype php set fo=tcqn
236 au Filetype php set spell
239 au Filetype php set textwidth=80
240 "au Filetype php set cindent
243 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
245 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
247 au BufRead,BufNewFile *.wxm set filetype=maxima
250 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
252 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
255 let g:LatexBox_split_side = "rightbelow"
256 "let g:LatexBox_split_resize = 1
257 let g:LatexBox_ref_pattern = '\c\\\a*ref\*\?\_\s*{'
259 let g:tex_flavor = "latex"
260 let g:LatexBox_output_type = "pdf"
261 let g:LatexBox_viewer = "okular"
262 let g:LatexBox_latexmk_async = 1
263 let g:LatexBox_latexmk_preview_continuously = 1
264 "let g:LatexBox_show_warnings = 0
265 let g:LatexBox_quickfix = 4
269 au Filetype tex set spell
272 au BufRead,BufNewFile *.cls set filetype=tex
273 au Filetype tex set textwidth=80
274 au Filetype tex set smartindent
275 " Override Tagbar Toggle with LatexBox TOC
276 au Filetype tex nmap <F10> :LatexTOCToggle<CR>
277 au Filetype tex nmap <F11> :LatexLabels<CR>
281 function TexTransUmlaute()
282 execute ':%s/ü/\\\"u/ge'
283 execute ':%s/Ü/\\\"U/&'
284 execute ':%s/ö/\\\"o/&'
285 execute ':%s/Ö/\\\"O/&'
286 execute ':%s/ä/\\\"a/&'
287 execute ':%s/Ä/\\\"A/&'
288 execute ':%s/ß/\\\"s/&'
289 execute ':%s/²/\^2/&'
292 function FindWordRepeatings()
293 execute '/\(\<\S\+\>\)\s\+\1\>'
294 " let pos = search('\(\<\S\+\>\)\s\+\1\>', "cw")
299 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
301 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
303 au Filetype python map <F5> :!python % <CR>
305 " vimrc file for following the coding standards specified in PEP 7 & 8.
307 " Number of spaces that a pre-existing tab is equal to.
308 " For the amount of space used for a new tab use shiftwidth.
309 au Filetype python set shiftwidth=4
310 au Filetype python set expandtab
312 " Wrap text after a certain number of characters
313 au Filetype python set textwidth=79
316 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
318 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
320 "Opens the current file in ipe
321 au Filetype xml map <M-o> :call OpenIn("ipe") <CR>
324 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
326 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
328 "Opens the current file in ipe
329 au Filetype gnuplot map <M-o> :call OpenIn("gnuplot -persist") <CR>
332 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
334 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
336 au BufRead,BufNewFile */.remind/* set filetype=remind
339 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
341 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
343 let g:unaryTagsStack = ""
344 au Filetype html,xml,xsl source /usr/share/vim/vimfiles/plugin/closetag.vim
347 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
349 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
351 let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
353 let g:ycm_min_num_of_chars_for_completion = 4
354 let g:ycm_collect_identifiers_from_tags_files = 1
355 let g:ycm_autoclose_preview_window_after_completion = 1
357 let g:ycm_key_list_select_completion = ['<Down>']
358 nnoremap <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR>
360 let g:ycm_filetype_whitelist = { 'c' : 1, 'cpp' : 1, 'cs' : 1, 'objc' : 1, 'java' : 1, 'python' : 1 }
362 "let g:ycm_server_use_vim_stdout = 1
363 "let g:ycm_server_log_level = 'debug'
366 if filereadable($HOME . "/.vimrc-local")
367 source ~/.vimrc-local
370 " Being able to load project specific vimrc files