1 " Purpose: My personal .vimrc
4 "profile start /tmp/profile.log
10 set backspace=indent,eol,start
15 set grepprg=grep\ -nH\ $*
25 set listchars=tab:»,trail:·,eol:$
34 set spelllang=de_at,en
39 set wildmode=longest,list:longest
44 filetype plugin indent on
46 runtime! autoload/plug.vim
47 " Check if there is vim-plug installed
48 if exists('g:loaded_plug')
49 call plug#begin('~/.config/nvim/plugged')
50 Plug 'Glench/Vim-Jinja2-Syntax'
51 Plug 'LaTeX-Box-Team/LaTeX-Box'
52 Plug 'benekastah/neomake'
53 Plug 'vim-airline/vim-airline'
54 Plug 'vim-airline/vim-airline-themes'
55 Plug 'chrisbra/csv.vim'
56 Plug 'craigemery/vim-autotag'
57 Plug 'godlygeek/tabular'
58 "Plug 'kien/ctrlp.vim'
60 Plug 'majutsushi/tagbar'
61 Plug 'mhinz/vim-signify'
62 Plug 'msanders/snipmate.vim'
63 Plug 'scrooloose/nerdcommenter'
64 Plug 'scrooloose/nerdtree'
65 " Plug 'scrooloose/syntastic'
67 Plug 'Shougo/deoplete.nvim'
68 Plug 'suan/vim-instant-markdown'
70 Plug 'thinca/vim-fontzoom'
71 Plug 'tpope/vim-ragtag'
72 Plug 'vim-scripts/CSApprox'
73 Plug 'vim-scripts/DetectIndent'
74 Plug 'vim-scripts/git_patch_tags.vim'
75 Plug 'vim-scripts/loremipsum'
78 autocmd! BufWritePost,BufEnter * Neomake
80 " If there is no vim-plug, try pathogen
82 runtime autoload/pathogen.vim
83 if exists("g:loaded_pathogen")
84 " Pathogen runtime path manipulation
85 call pathogen#runtime_append_all_bundles()
86 call pathogen#helptags()
92 set rtp^=/usr/share/vim/vimfiles
101 let $NVIM_TUI_ENABLE_TRUE_COLOR=1
103 let g:CSApprox_attr_map = { 'bold' : 'bold', 'italic' : 'underline', 'sp' : 'bg' }
105 colorscheme shuber-wombat
108 " Use the below highlight group when displaying bad whitespace is desired.
109 highlight BadWhitespace ctermbg=red guibg=red
110 " Make trailing whitespace be flagged as bad.
111 au Filetype python,tex,c,cpp,cs,objc,java,vim syn match BadWhitespace /\s\+$/ containedin=ALL
112 au Filetype python,tex,c,cpp,cs,objc,java,vim let g:airline#extensions#whitespace#enabled = 0
115 " Detect indentation, but otherwise set expandtab
116 if exists(":DetectIndent")
117 au BufReadPost * :DetectIndent
121 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
123 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
125 let g:airline_powerline_fonts = 0
126 let g:airline_theme = 'wombat'
128 let g:airline#extensions#tabline#enabled = 1
129 let g:airline#extensions#tagbar#enabled = 0
130 let g:airline#extensions#whitespace#enabled = 0
131 let g:airline#extensions#branch#enabled = 1
132 let g:airline#extensions#branch#use_vcscommand = 1
134 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
136 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
138 "Open current file with a specific program
139 function OpenIn(prog)
140 execute ":!" . a:prog . " % &"
144 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
146 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
148 nmap <s-PageDown> :bn<CR>
149 nmap <s-PageUp> :bp<CR>
151 map <a-c> <plug>NERDCommenterToggle
152 nmap <F9> :NERDTreeToggle<CR>
153 nmap <F10> :TagbarToggle<CR>
157 "vmap <c-s> <Esc><c-s>gv
158 "imap <c-s> <c-o><c-s>
161 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
163 """"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
165 "let fortran_free_source=1
166 au BufNewFile *.f90 set fortran_free_source=1
167 au Filetype fortran set cindent cst csto=0
170 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
171 " C, C++, C#, objc, java
172 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
174 au Filetype c,cpp,cs,objc,java map <buffer> <F4> :cnext <CR>
175 au Filetype c,cpp,cs,objc,java map <buffer> <S-F4> :cprevious <CR>
176 au Filetype c,cpp,cs,objc,java map <buffer> <F11> :AS <CR>
177 au Filetype c,cpp,cs,objc,java map <buffer> <S-F11> :A <CR>
178 au Filetype c,cpp,cs,objc,java set cindent cst csto=0
179 au Filetype c,cpp,cs,objc map <buffer> <F7> :make <CR>
180 au Filetype java map <buffer> <F7> :!ant -f ../build.xml <CR>
181 au Filetype c,cpp,cs,objc set makeprg=make
184 "Prepend the namespace to an identifier, e.g. 'std::' before 'map' excluding
185 "those in C/C++ comments.
186 function PrependCppNamespaceToIdent(ns, id)
188 " To match Not to match
192 "|/* */ /* */ id |/* */ // id
200 " In order to not match '* id' it is assumed that multi-line comment lines
201 " in the middle begin with a star.
203 " If #include and // and /* and ^* and :: is not prepend:
204 execute ':%s@\(\(#include\|\/\/\|\/\*\|^\s*\*[^/]\).*\|::\)\@<!\<' . a:id . '\>@' . a:ns . '::' . a:id . '@ge'
205 " If #include and // and :: is not prepend, but */ is, and no further /* or // are found
206 execute ':%s@\(\(#include\|\/\/\).*\)\@<!\*\/\(\/[^\/\*]\|[^\/]\)*\zs\(::\)\@<!\<' . a:id . '\>@' . a:ns . '::' . a:id . '@ge'
210 "Prepend STL namespace 'std::' to several identifiers
211 function PrependSTLNamespace()
212 " This list of identifier is not complete, but adding all of them is too
213 " much. We rather like to add identifieres that are 'typical' for C++.
214 " Others, like 'move' are likely to not be C++ specific. In this cases the
215 " user is asked to call PrependCppNamespaceToIdent by hand.
217 let id = id +['cin', 'cout', 'cerr', 'endl']
218 let id = id +['swap', 'sort', 'max', 'min']
219 let id = id +['vector', 'deque', 'list', 'map', 'multimap', 'set']
220 let id = id +['queue', 'stack', 'priority_queue']
221 let id = id +['ostream', 'istream', 'sstream']
222 let id = id +['pair', 'string']
225 call PrependCppNamespaceToIdent("std", i)
229 function EscapeHexToChar()
230 echo 'Call "x/Nxb addr" in GDB to print N bytes at addr'
232 execute '%s/\s*0x\(\x\x\)/\\x\1/g'
233 execute '%s/^\(.*\)$/"\1"/'
236 function InsertIncludeGuardsWithoutEndif()
237 let gatename = substitute(expand("%:t"), "\\.", "_", "g") . '_' . strpart(system('pwgen -c 16 1'), 0, 16)
238 execute "normal! i#ifndef " . gatename
239 execute "normal! o#define " . gatename
242 function AddIncludeGuards()
243 execute "normal! Go#endif"
245 call InsertIncludeGuardsWithoutEndif()
248 autocmd BufNewFile *.{h,hpp,hxx} call AddIncludeGuards()
251 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
253 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
255 au Filetype text set textwidth=80
256 au Filetype markddown set textwidth=80
257 "According to thunderbirds settings
258 au Filetype mail set textwidth=72
259 au Filetype mail set expandtab
261 "a and w reformat the paragraph automatically and a new paragraph
262 "is indicated by lines not ending with white-space
264 au Filetype mail,text set fo+=n spell
268 au Filetype mail syn match Statement /^\s*-*\s*>8\s*-*\s*$/
269 au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/
272 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
274 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
276 "au Filetype php set fo=tcqn
278 au Filetype php set spell
281 au Filetype php set textwidth=80
282 "au Filetype php set cindent
285 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
287 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
289 au BufRead,BufNewFile *.wxm set filetype=maxima
292 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
294 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
296 let g:LatexBox_split_side = "rightbelow"
297 "let g:LatexBox_split_resize = 1
298 let g:LatexBox_ref_pattern = '\c\\\a*ref\*\?\_\s*{'
300 let g:tex_flavor = "latex"
301 let g:LatexBox_output_type = "pdf"
302 let g:LatexBox_viewer = "okular"
303 let g:LatexBox_latexmk_async = 1
304 let g:LatexBox_latexmk_preview_continuously = 1
305 "let g:LatexBox_show_warnings = 0
306 let g:LatexBox_quickfix = 4
309 au Filetype tex set spell
312 au BufRead,BufNewFile *.cls set filetype=tex
313 au Filetype tex set textwidth=80
314 au Filetype tex set shiftwidth=2
315 au Filetype tex set smartindent
316 " Override Tagbar Toggle with LatexBox TOC
317 au Filetype tex nmap <buffer> <F10> :LatexTOCToggle<CR>
318 au Filetype tex nmap <buffer> <F11> :LatexLabels<CR>
322 function TexTransUmlaute()
323 execute ':%s/ü/\\\"u/ge'
324 execute ':%s/Ü/\\\"U/&'
325 execute ':%s/ö/\\\"o/&'
326 execute ':%s/Ö/\\\"O/&'
327 execute ':%s/ä/\\\"a/&'
328 execute ':%s/Ä/\\\"A/&'
329 execute ':%s/ß/\\\"s/&'
330 execute ':%s/²/\^2/&'
333 function FindWordRepeatings()
334 execute '/\(\<\S\+\>\)\s\+\1\>'
335 " let pos = search('\(\<\S\+\>\)\s\+\1\>', "cw")
340 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
342 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
344 au Filetype python map <buffer> <F5> :!python % <CR>
346 " vimrc file for following the coding standards specified in PEP 7 & 8.
348 " Number of spaces that a pre-existing tab is equal to.
349 " For the amount of space used for a new tab use shiftwidth.
350 au Filetype python set shiftwidth=4
351 au Filetype python set expandtab
353 " Wrap text after a certain number of characters
354 au Filetype python set textwidth=79
356 let g:syntastic_python_checkers = ["pyflakes"]
358 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
360 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
362 "Opens the current file in ipe
363 au BufRead,BufNewFile *.ipe set filetype=ipe
364 au Filetype xml,ipe map <buffer> <M-o> :call OpenIn("ipe") <CR>
366 au Filetype xml let g:tagbar_sort = 0
367 let g:tagbar_type_xml = {
368 \ 'ctagstype' : 'xml',
374 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
376 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
378 "Opens the current file in ipe
379 au Filetype gnuplot map <buffer> <M-o> :call OpenIn("gnuplot -persist") <CR>
382 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
384 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
386 au BufRead,BufNewFile */.remind/* set filetype=remind
389 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
391 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
393 au BufRead,BufNewFile *.org set filetype=org
394 let g:org_todo_keywords=['TODO', 'FEEDBACK', 'VERIFY', '|', 'DONE', 'DELEGATED']
395 let g:org_todo_keyword_faces = [['FEEDBACK', 'magenta'], ['TODO', 'yellow']]
398 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
400 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
402 let g:instant_markdown_autostart = 0
403 let g:instant_markdown_slow = 1
404 au Filetype markdown map <buffer> <F5> :InstantMarkdownPreview<CR>
405 au Filetype markdown let g:tagbar_sort = 0
407 let g:tagbar_type_markdown = {
408 \ 'ctagstype' : 'markdown',
416 if executable('marktag')
417 let g:tagbar_type_markdown = {
418 \ 'ctagstype' : 'markdown',
419 \ 'ctagsbin' : 'marktag',
434 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
436 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
438 let g:deoplete#enable_at_startup = 1
440 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
442 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
444 let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py'
445 let g:ycm_confirm_extra_conf = 0
447 let g:ycm_min_num_of_chars_for_completion = 4
448 let g:ycm_collect_identifiers_from_tags_files = 1
449 let g:ycm_autoclose_preview_window_after_completion = 1
451 let g:ycm_key_list_select_completion = ['<Down>']
452 nnoremap <buffer> <leader>jd :YcmCompleter GoToDefinitionElseDeclaration<CR>
454 let g:ycm_filetype_whitelist = { 'c' : 1, 'cpp' : 1, 'cs' : 1, 'objc' : 1, 'java' : 1, 'python' : 1 }
456 "let g:ycm_server_use_vim_stdout = 1
457 "let g:ycm_server_log_level = 'debug'
460 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
462 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
464 let g:syntastic_mode_map = { 'mode' : 'active', 'active_filetypes' : [], 'passive_filetypes' : ['html'] }
465 let g:ycm_show_diagnostics_ui = 0
466 let g:syntastic_c_checkers = ["cppcheck"]
467 let g:syntastic_cpp_checkers = g:syntastic_c_checkers
470 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
472 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
474 let g:signify_vcs_list = ['git']
479 if filereadable($HOME . "/.vimrc-local")
480 source ~/.vimrc-local
483 " Being able to load project specific vimrc files