2 let b:vim_conf_dir = $HOME.'/.vim'
4 let b:vim_conf_dir = $HOME.'\vimfiles'
8 if isdirectory( b:vim_conf_dir . '/tmp/') == 0
9 call mkdir(b:vim_conf_dir.'/tmp/', 'p', 0700)
14 if filereadable(b:vim_conf_dir . '/plugins.vundel.vim')
15 exec 'source ' . b:vim_conf_dir . '/plugins.vundel.vim'
18 " auskommentiert, macht in screen das nix gut aussieht..
22 let g:gruvbox_contrast_dark = 'hard'
23 let g:gruvbox_italicize_comments = 0
25 catch /^Vim\%((\a\+)\)\=:E185/
26 " wird evtl rest instlliert... E185 heißt nicht gefunden..
31 set backspace=indent,eol,start
57 " Tab-completion in command-line mode
61 set wildignore=*.pdf,*.fo,
74 " remove =, thus 'gf' works whit filepath asignemens like myvar=/path/tofile
77 let perl_include_pod = 1
80 autocmd FileType perl setlocal complete-=i
95 nnoremap <Leader>i a'" << << "' <Esc>6hi
96 nnoremap <Leader>a a'{}' <Esc>2hi
97 nnoremap <Leader>A a'"+ +"' <Esc>4hi
98 autocmd FileType cpp nnoremap <Leader>a a'"<< <<"' <Esc>5hi
100 " see :h restore-position
101 nnoremap <Leader>= msgg=G`s
105 inoremap ts<tab> // TODOts: <Esc>=$A
106 inoremap obs<tab> //TODOObsolete: kann nach der Abspaltung von XXXX entfernt werden<Esc>=$0fXviw
108 inoremap no<tab> <Esc>0i <nodoc /><Esc>0i///<Esc>=$
109 inoremap td<tab> <Esc>0i//TODOts: doku<CR><summary> </summary><Esc>0i/// <Esc>kVj=$
111 autocmd InsertEnter * set timeoutlen=500
112 autocmd InsertLeave * set timeoutlen=1000
114 inoremap in<tab> <Esc>0i<inheritdoc /><Esc>0i///<Esc>V=
119 nnoremap <C-p> :bprev<CR>
120 nnoremap <C-n> :bnext<CR>
122 nnoremap <leader>e :tabedit $MYVIMRC<CR>
124 nnoremap ZZ :wqall<CR>
125 nnoremap <F6> :wa<CR>:make -j 8<CR><CR>
126 inoremap <F6> <esc>:wa<CR>:make -j 8<CR><CR>
128 nnoremap <F5> :wa\|!./%<CR>
129 inoremap <F5> <esc>:wa\|!./%<CR>
131 nnoremap <C-l> <C-W>l
133 " Copy paste to/from system clipboard
134 vnoremap <leader>c "*y
135 noremap <leader>v "*p
136 inoremap <leader>v <esc>"*p
137 vnoremap <leader>v "*p
139 "nnoremap <Leader>= mzgg=G`z<CR>
140 nnoremap <F2> :call FormatDocument()<CR>
142 cmap w!! w !sudo tee > /dev/null %
144 "move visually selected
146 vnoremap <M-j> :m '>+1<CR>gv=gv
147 vnoremap <M-k> :m '<-2<CR>gv=gv
148 nnoremap <M-k> :m -2<CR>==
149 nnoremap <M-j> :m +1<CR>==
151 " repeat last command on all selected:
152 vnoremap . :normal.<CR>
154 vnoremap <leader>tt :Tabular /^[^-+=]*\zs\S*=/l1l1<cr>
155 vnoremap <leader>t, :Tabular /,\zs/l1l1<cr>
156 vnoremap <leader>t<space> :Tabular /\s\+\zs/l1l0<cr>
157 vnoremap <leader>t: :Tabular /:\zs/l1l0<cr>
158 vnoremap <leader>t( :Tabular /(/l1l0<cr>
160 " append word under cursor with 'or' to current search pattern
161 nnoremap <Leader>s yiw/<C-R>/\\|<C-R>"<cr>
162 " append selection with 'or' to current search pattern
163 vnoremap <Leader>s y/<C-R>/\\|<C-R>"<cr>
165 cmap w!! w !sudo tee % >/dev/null
166 nnoremap <Leader>mh :wa<CR>:silent !mhsend -run reload code<CR>:redraw!<CR>
167 nnoremap <Leader>ll iprint_log("");<Esc>V=0f(la
170 nnoremap <Leader>r :source ~/vimfiles/vimrc<CR>
172 nnoremap <Leader>r :source ~/.vim/vimrc<CR>
175 filetype plugin indent on
177 " ack seems to have vanished from artfull, thus use silversearchger-ag
180 let g:ackprg = 'ag --vimgrep'
183 set list listchars=tab:→\ ,trail:·
185 hi Visual guifg=White guibg=Blue gui=bold
187 set diffopt+=vertical
189 set diffopt+=algorithm:patience
190 "jump to next diff and center line
191 noremap <leader>n ]cz.
192 noremap <leader>p [cz.
194 set guifont=DejaVu_Sans_Mono:h9:cANSI:qDRAFT
198 set diffopt+=vertical
200 set diffopt+=algorithm:patience
203 highlight DiffText term=reverse cterm=reverse ctermfg=214 ctermbg=234 gui=reverse guifg=lightgreen guibg=DarkGreen
206 autocmd GuiEnter * simalt ~x
207 set guifont=DejaVu_Sans_Mono:h8:cANSI:qDRAFT
209 " make all diff windows the same size
210 autocmd VimResized * wincmd =
211 autocmd VimEnter * 2wincmd w
212 autocmd VimEnter * syntax off
213 autocmd VimEnter * set guioptions+=b
217 if has("gui_running")
218 set lines=999 columns=120
220 " from /etc/vim/vimrc (restore last editing position)
222 au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
226 let &colorcolumn="121"
227 highlight ColorColumn ctermbg=lightgray guibg=lightcyan
232 " remove currently unused fugitive buffers:
233 autocmd BufReadPost fugitive://* set bufhidden=delete
235 " reset terminal colors after vim leaves
236 "if !has("gui_running")
237 " au VimLeave * !echo -ne "\033[0m"
240 " macht dass auch in screen auf dem server der vollstaendige hintergund gmalt
244 if has ('win32') || has('win32unix')
245 let g:vimwiki_list = [
247 \ 'path':'~/vimwiki',
248 \ 'path_html':'~/vimwiki/html/',
249 \ 'syntax': 'markdown',
254 let g:vimwiki_list = [
257 \ 'path_html':'~/p/wiki/html/',
258 \ 'syntax': 'markdown',
265 if isdirectory( b:vim_conf_dir . '/tmp/backup') == 0
266 call mkdir(b:vim_conf_dir.'/tmp/backup', 'p', 0700)
268 exec 'set backupdir='. b:vim_conf_dir.'/tmp/backup//'
271 " Save your swp files to a less annoying place than the current directory.
272 " If you have .vim-swap in the current directory, it'll use that.
273 " Otherwise it saves it to ~/.vim/swap, ~/tmp or .
274 if isdirectory( b:vim_conf_dir . '/tmp/swap') == 0
275 call mkdir(b:vim_conf_dir.'/tmp/swap', 'p', 0700)
277 exec 'set directory='. b:vim_conf_dir.'/tmp/swap//'
279 " viminfo stores the the state of your previous editing session
281 set viminfo+=n~/vimfiles/tmp/viminfo
283 set viminfo+=n~/.vim/tmp/viminfo
286 " letzte suche beim öffnen einer Datei sofort wieder anzeigen
289 if exists("+undofile")
290 " undofile - This allows you to use undos after exiting and restarting
291 " This, like swap and backups, uses .vim-undo first, then ~/.vim/undo
292 " :help undo-persistence
293 " This is only present in 7.3+
294 if isdirectory( b:vim_conf_dir . '/tmp/undo') == 0
295 call mkdir(b:vim_conf_dir.'/tmp/undo', 'p', 0700)
297 exec 'set undodir='. b:vim_conf_dir.'/tmp/undo'
302 function! FormatDocument()
303 let save_pos = getpos(".")
305 call setpos('.', save_pos)
309 noremap <Leader>x :call XmlPretty()<cr>
311 function! XmlPretty()
312 let save_pos = getpos(".")
315 :silent! %s/></>\r</g
318 call setpos('.', save_pos)
321 " fix logger stuff to use the newer api call
322 " remove #regions and whitspaces
323 " use {var} instead of " + var + "
324 noremap <Leader>fx ma:1,$ call FixCsharp()<cr>'a
325 function! FixCsharp()
326 let save_pos = getpos(".")
328 :silent! %g/^\s*#\(end\)\{0,1\}region/d
330 :silent! %g/\.WriteException(/normal 0df,$^iLog.Exception(
\eV=
331 :silent! %g/\.WriteMessage(/normal 0f(ldf."ayiw0P0xlveu0iLog.
\eelcf,(
\eld0$^PV=
333 " '+ varname +' durch '{varname}' ersetzen
334 :silent! %s/"\s*+\s*\(.\{-\}\)\s*+\s*"/{\1}/g
335 :silent! %s/"\s*+\s*\(.\{-\}\)\s*+\s*$/{\1}" +/g
336 :silent! %s/"\s*+\s*\(.\{-\}\)\s*);/{\1}");/g
338 "ersetze 'Zeilenanfang "'
339 :silent! %s/\(^\s*\)\("[^"]*{\)/\1$\2/g
340 :silent! %s/[^$]\(".*{\)/$\1/g
342 " mehrere leerzeilen durch eine einzelne ersetzen:
344 :silent! %s/\n\{3,}/\r\r/e
346 call setpos('.', save_pos)
349 function! FixWhitespace()
350 " convert tabs to spaces
352 " remove trailing whitespace
354 :silent! g/\s*<!--\**-->\s*/d
356 " remov '//******' and '//#####'
357 :silent! g/\/\/\(\*\|#\)*\s*$/d
358 " remove excessive newlines
359 :silent! %s/\n\n\n\+/
\r\r/
363 function! UndoCSharStringInterpolation()
365 silent! s/{\(.\{-}\)}/" + \1 + "/g
369 inoremap <F4> <Esc>:ALEToggle<CR>
370 nnoremap <F4> <Esc>:ALEToggle<CR>
371 let g:ale_linters = {
372 \ 'cpp': ['gcc', 'cppcheck', 'clang'],
373 \ 'perl': ['perl', 'perlcritic'],
375 let b:ale_warn_about_trailing_whitespace = 1
376 let g:ale_sign_column_always = 1
377 let g:ale_cpp_clang_options =
378 \ '-std=c++14 -Wall -pedantic -fPIC
379 \ -I/usr/include/x86_64-linux-gnu/qt5
380 \ -I/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport
381 \ -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets
382 \ -I/usr/include/x86_64-linux-gnu/qt5/QtGui
383 \ -I/usr/include/x86_64-linux-gnu/qt5/QtCore
384 \ -I/usr/include/libdrm
385 \ -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g+
388 let g:ale_cpp_gcc_options =
389 \ '-std=c++14 -Wall -pedantic -fPIC
390 \ -I/usr/include/x86_64-linux-gnu/qt5
391 \ -I/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport
392 \ -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets
393 \ -I/usr/include/x86_64-linux-gnu/qt5/QtGui
394 \ -I/usr/include/x86_64-linux-gnu/qt5/QtCore
395 \ -I/usr/include/libdrm
396 \ -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g+
401 if has("patch-7.4.354")
402 " Indents word-wrapped lines as much as the 'parent' line
404 " Ensures word-wrap does not split words
409 hi CursorLineNr ctermbg=black guibg=black
410 hi CursorLine ctermbg=black guibg=black
413 au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
414 au WinLeave * setlocal nocursorline
419 let g:acp_enableAtStartup = 1
420 let g:acp_behaviorPerlOmniLength = 0
421 let g:acp_behaviorPhpOmniLength = 0
422 let g:acp_completeoptPreview = 1
423 let g:acp_behaviorPythonOmniLength = 0
424 let g:acp_behaviorXmlOmniLength = 0
425 let g:acp_behaviorHtmlOmniLength = 0
426 let g:acp_behaviorCssOmniPropertyLength = 1
427 let g:acp_behaviorCssOmniValueLength = 0
429 highlight ExtraWhitespace ctermfg=red guifg=red ctermbg=white guibg=DarkGrey
431 " keine trailing whitespaces in hub log files anzeigen
432 match ExtraWhitespace /\s\+$/
434 let g:ale_python_flake8_options = "--max-line-length=120"
437 function! CopyFormatted(line1, line2)
438 let prev_number = &number
439 let prev_relativenumber = &relativenumber
440 let prev_background = &background
443 setlocal relativenumber!
444 setlocal background=light
445 " wenn ft manuel gesetzt war wird das von set background zurueckgesetzt, deswegen gleich wieder setzen
446 exe 'setlocal ft='.expand(prev_ft)
448 execute a:line1 . "," . a:line2 . "TOhtml"
450 !start /min powershell -noprofile "gcb | scb -as"
456 if (prev_relativenumber)
459 exe 'setlocal background='.expand(prev_background)
460 exe 'setlocal ft='.expand(prev_ft)
463 command! -range=% HtmlClip silent call CopyFormatted(<line1>,<line2>)
466 augroup logfilesgroup
468 au! BufRead,BufNewFile *.log setlocal nowrap |
469 \ setlocal textwidth=0 |
470 \ let &colorcolumn=""