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
43 filetype plugin indent on
45 " Pathogen runtime path manipulation
46 "call pathogen#infect() "Using the infect method breaks ft detection
47 call pathogen#runtime_append_all_bundles()
48 call pathogen#helptags()
51 "Power saving tip: powertop-homepage
52 let &guicursor = &guicursor . ",a:blinkon0"
53 "According to vim help -- enable mouse in xterm...
58 let g:CSApprox_attr_map = { 'bold' : 'bold', 'italic' : 'underline', 'sp' : 'bg' }
59 colorscheme shuber-wombat
62 " Use the below highlight group when displaying bad whitespace is desired.
63 highlight BadWhitespace ctermbg=red guibg=red
64 " Make trailing whitespace be flagged as bad.
65 au Filetype python,tex,c,cpp,cs,objc,java,vim syn match BadWhitespace /\s\+$/ containedin=ALL
66 au Filetype python,tex,c,cpp,cs,objc,java,vim let g:airline#extensions#whitespace#enabled = 0
69 " Detect indentation, but otherwise set expandtab
70 if exists(":DetectIndent")
71 au BufReadPost * :DetectIndent
75 let g:syntastic_mode_map = { 'mode' : 'active', 'active_filetypes' : [], 'passive_filetypes' : ['html'] }
78 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
80 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
82 let g:airline_powerline_fonts = 0
83 let g:airline_theme = 'wombat'
85 let g:airline#extensions#tabline#enabled = 1
86 let g:airline#extensions#tagbar#enabled = 0
87 let g:airline#extensions#whitespace#enabled = 0
88 let g:airline#extensions#branch#enabled = 1
89 let g:airline#extensions#branch#use_vcscommand = 1
91 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
93 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
95 "Open current file with a specific program
97 execute ":!" . a:prog . " % &"
101 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
103 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
105 nmap <s-PageDown> :bn<CR>
106 nmap <s-PageUp> :bp<CR>
108 map <a-c> <plug>NERDCommenterToggle
109 nmap <F9> :NERDTreeToggle<CR>
110 nmap <F10> :TagbarToggle<CR>
114 "vmap <c-s> <Esc><c-s>gv
115 "imap <c-s> <c-o><c-s>
118 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
120 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
122 "let fortran_free_source=1
123 au BufNewFile *.f90 set fortran_free_source=1
124 au Filetype fortran set cindent cst csto=0
127 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
128 " C, C++, C#, objc, java
129 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
131 au Filetype c,cpp,cs,objc,java map <buffer> <F4> :cnext <CR>
132 au Filetype c,cpp,cs,objc,java map <buffer> <S-F4> :cprevious <CR>
133 au Filetype c,cpp,cs,objc,java map <buffer> <F11> :AS <CR>
134 au Filetype c,cpp,cs,objc,java map <buffer> <S-F11> :A <CR>
135 au Filetype c,cpp,cs,objc,java set cindent cst csto=0
136 au Filetype c,cpp,cs,objc map <buffer> <F7> :make <CR>
137 au Filetype java map <buffer> <F7> :!ant -f ../build.xml <CR>
138 au Filetype c,cpp,cs,objc set makeprg=make
141 "Prepend the namespace to an identifier, e.g. 'std::' before 'map' excluding
142 "those in C/C++ comments.
143 function PrependCppNamespaceToIdent(ns, id)
145 " To match Not to match
149 "|/* */ /* */ id |/* */ // id
157 " In order to not match '* id' it is assumed that multi-line comment lines
158 " in the middle begin with a star.
160 " If #include and // and /* and ^* and :: is not prepend:
161 execute ':%s@\(\(#include\|\/\/\|\/\*\|^\s*\*[^/]\).*\|::\)\@<!\<' . a:id . '\>@' . a:ns . '::' . a:id . '@ge'
162 " If #include and // and :: is not prepend, but */ is, and no further /* or // are found
163 execute ':%s@\(\(#include\|\/\/\).*\)\@<!\*\/\(\/[^\/\*]\|[^\/]\)*\zs\(::\)\@<!\<' . a:id . '\>@' . a:ns . '::' . a:id . '@ge'
167 "Prepend STL namespace 'std::' to several identifiers
168 function PrependSTLNamespace()
169 " This list of identifier is not complete, but adding all of them is too
170 " much. We rather like to add identifieres that are 'typical' for C++.
171 " Others, like 'move' are likely to not be C++ specific. In this cases the
172 " user is asked to call PrependCppNamespaceToIdent by hand.
174 let id = id +['cin', 'cout', 'cerr', 'endl']
175 let id = id +['swap', 'sort', 'max', 'min']
176 let id = id +['vector', 'deque', 'list', 'map', 'multimap', 'set']
177 let id = id +['queue', 'stack', 'priority_queue']
178 let id = id +['ostream', 'istream', 'sstream']
179 let id = id +['pair', 'string']
182 call PrependCppNamespaceToIdent("std", i)
186 function EscapeHexToChar()
187 echo 'Call "x/Nxb addr" in GDB to print N bytes at addr'
189 execute '%s/\s*0x\(\x\x\)/\\x\1/g'
190 execute '%s/^\(.*\)$/"\1"/'
193 function InsertIncludeGuardsWithoutEndif()
194 let gatename = substitute(expand("%:t"), "\\.", "_", "g") . '_' . strpart(system('pwgen -c 16 1'), 0, 16)
195 execute "normal! i#ifndef " . gatename
196 execute "normal! o#define " . gatename
199 function AddIncludeGuards()
200 execute "normal! Go#endif"
202 call InsertIncludeGuardsWithoutEndif()
205 autocmd BufNewFile *.{h,hpp,hxx} call AddIncludeGuards()
208 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
210 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
212 au Filetype text set textwidth=80
213 au Filetype markddown set textwidth=80
214 "According to thunderbirds settings
215 au Filetype mail set textwidth=72
216 au Filetype mail set expandtab
218 "a and w reformat the paragraph automatically and a new paragraph
219 "is indicated by lines not ending with white-space
221 au Filetype mail,text set fo+=n spell
225 au Filetype mail syn match Statement /^\s*-*\s*>8\s*-*\s*$/
226 au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/
229 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
231 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
233 "au Filetype php set fo=tcqn
235 au Filetype php set spell
238 au Filetype php set textwidth=80
239 "au Filetype php set cindent
242 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
244 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
246 au BufRead,BufNewFile *.wxm set filetype=maxima
249 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
251 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
254 let g:LatexBox_split_side = "rightbelow"
255 "let g:LatexBox_split_resize = 1
256 let g:LatexBox_ref_pattern = '\c\\\a*ref\*\?\_\s*{'
258 let g:tex_flavor = "latex"
259 let g:LatexBox_output_type = "pdf"
260 let g:LatexBox_viewer = "okular"
261 let g:LatexBox_latexmk_async = 1
262 let g:LatexBox_latexmk_preview_continuously = 1
263 "let g:LatexBox_show_warnings = 0
264 let g:LatexBox_quickfix = 4
268 au Filetype tex set spell
271 au BufRead,BufNewFile *.cls set filetype=tex
272 au Filetype tex set textwidth=80
273 au Filetype tex set smartindent
274 " Override Tagbar Toggle with LatexBox TOC
275 au Filetype tex nmap <buffer> <F10> :LatexTOCToggle<CR>
276 au Filetype tex nmap <buffer> <F11> :LatexLabels<CR>
280 function TexTransUmlaute()
281 execute ':%s/ü/\\\"u/ge'
282 execute ':%s/Ü/\\\"U/&'
283 execute ':%s/ö/\\\"o/&'
284 execute ':%s/Ö/\\\"O/&'
285 execute ':%s/ä/\\\"a/&'
286 execute ':%s/Ä/\\\"A/&'
287 execute ':%s/ß/\\\"s/&'
288 execute ':%s/²/\^2/&'
291 function FindWordRepeatings()
292 execute '/\(\<\S\+\>\)\s\+\1\>'
293 " let pos = search('\(\<\S\+\>\)\s\+\1\>', "cw")
298 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
300 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
302 au Filetype python map <buffer> <F5> :!python % <CR>
304 " vimrc file for following the coding standards specified in PEP 7 & 8.
306 " Number of spaces that a pre-existing tab is equal to.
307 " For the amount of space used for a new tab use shiftwidth.
308 au Filetype python set shiftwidth=4
309 au Filetype python set expandtab
311 " Wrap text after a certain number of characters
312 au Filetype python set textwidth=79
315 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
317 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
319 "Opens the current file in ipe
320 au BufRead,BufNewFile *.ipe set filetype=ipe
321 au Filetype xml,ipe map <buffer> <M-o> :call OpenIn("ipe") <CR>
323 au Filetype xml let g:tagbar_sort = 0
324 let g:tagbar_type_xml = {
325 \ 'ctagstype' : 'xml',
331 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
333 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
335 "Opens the current file in ipe
336 au Filetype gnuplot map <buffer> <M-o> :call OpenIn("gnuplot -persist") <CR>
339 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
341 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
343 au BufRead,BufNewFile */.remind/* set filetype=remind
346 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
348 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
350 au BufRead,BufNewFile *.org set filetype=org
351 let g:org_todo_keywords=['TODO', 'FEEDBACK', 'VERIFY', '|', 'DONE', 'DELEGATED']
352 let g:org_todo_keyword_faces = [['FEEDBACK', 'magenta'], ['TODO', 'yellow']]
355 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
357 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
359 let g:instant_markdown_autostart = 0
360 let g:instant_markdown_slow = 1
361 au Filetype markdown map <buffer> <F5> :InstantMarkdownPreview<CR>
362 au Filetype markdown let g:tagbar_sort = 0
364 let g:tagbar_type_markdown = {
365 \ 'ctagstype' : 'markdown',
373 if executable('marktag')
374 let g:tagbar_type_markdown = {
375 \ 'ctagstype' : 'markdown',
376 \ 'ctagsbin' : 'marktag',
391 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
393 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
395 let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
397 let g:ycm_min_num_of_chars_for_completion = 4
398 let g:ycm_collect_identifiers_from_tags_files = 1
399 let g:ycm_autoclose_preview_window_after_completion = 1
401 let g:ycm_key_list_select_completion = ['<Down>']
402 nnoremap <buffer> <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR>
404 let g:ycm_filetype_whitelist = { 'c' : 1, 'cpp' : 1, 'cs' : 1, 'objc' : 1, 'java' : 1, 'python' : 1 }
406 "let g:ycm_server_use_vim_stdout = 1
407 "let g:ycm_server_log_level = 'debug'
410 if filereadable($HOME . "/.vimrc-local")
411 source ~/.vimrc-local
414 " Being able to load project specific vimrc files