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> /// <para><CR> OBSOLETE kann nach der Abspaltung von 1.12 entfernt werden<CR><Esc>=$A
107 inoremap no<tab> <Esc>0i <nodoc /><Esc>0i///<Esc>=$
108 inoremap td<tab> <Esc>0i//TODOts: doku<CR><summary> </summary><Esc>0i/// <Esc>kVj=$
110 autocmd InsertEnter * set timeoutlen=500
111 autocmd InsertLeave * set timeoutlen=1000
113 inoremap in<tab> <Esc>0i<inheritdoc /><Esc>0i///<Esc>V=
118 nnoremap <C-p> :bprev<CR>
119 nnoremap <C-n> :bnext<CR>
121 nnoremap <leader>e :tabedit $MYVIMRC<CR>
123 nnoremap ZZ :wqall<CR>
124 nnoremap <F6> :wa<CR>:make -j 8<CR><CR>
125 inoremap <F6> <esc>:wa<CR>:make -j 8<CR><CR>
127 nnoremap <F5> :wa\|!./%<CR>
128 inoremap <F5> <esc>:wa\|!./%<CR>
130 nnoremap <C-l> <C-W>l
132 " Copy paste to/from system clipboard
133 vnoremap <leader>c "*y
134 noremap <leader>v "*p
135 inoremap <leader>v <esc>"*p
136 vnoremap <leader>v "*p
138 "nnoremap <Leader>= mzgg=G`z<CR>
139 nnoremap <F2> :call FormatDocument()<CR>
141 cmap w!! w !sudo tee > /dev/null %
143 "move visually selected
145 vnoremap <M-j> :m '>+1<CR>gv=gv
146 vnoremap <M-k> :m '<-2<CR>gv=gv
147 nnoremap <M-k> :m -2<CR>==
148 nnoremap <M-j> :m +1<CR>==
150 " repeat last command on all selected:
151 vnoremap . :normal.<CR>
153 vnoremap <leader>tt :Tabular /^[^-+=]*\zs\S*=/l1l1<cr>
154 vnoremap <leader>t, :Tabular /,\zs/l1l1<cr>
155 vnoremap <leader>t<space> :Tabular /\s\+\zs/l1l0<cr>
156 vnoremap <leader>t: :Tabular /:\zs/l1l0<cr>
157 vnoremap <leader>t( :Tabular /(/l1l0<cr>
159 " append word under cursor with 'or' to current search pattern
160 nnoremap <Leader>s yiw/<C-R>/\\|<C-R>"<cr>
161 " append selection with 'or' to current search pattern
162 vnoremap <Leader>s y/<C-R>/\\|<C-R>"<cr>
164 cmap w!! w !sudo tee % >/dev/null
165 nnoremap <Leader>mh :wa<CR>:silent !mhsend -run reload code<CR>:redraw!<CR>
166 nnoremap <Leader>ll iprint_log("");<Esc>V=0f(la
169 nnoremap <Leader>r :source ~/vimfiles/vimrc<CR>
171 nnoremap <Leader>r :source ~/.vim/vimrc<CR>
174 filetype plugin indent on
176 " ack seems to have vanished from artfull, thus use silversearchger-ag
179 let g:ackprg = 'ag --vimgrep'
182 set list listchars=tab:→\ ,trail:·
184 hi Visual guifg=White guibg=Blue gui=bold
186 set diffopt+=vertical
188 set diffopt+=algorithm:patience
189 "jump to next diff and center line
190 noremap <leader>n ]cz.
191 noremap <leader>p [cz.
193 set guifont=DejaVu_Sans_Mono:h11:cANSI:qDRAFT
197 set diffopt+=vertical
199 set diffopt+=algorithm:patience
202 highlight DiffText term=reverse cterm=reverse ctermfg=214 ctermbg=234 gui=reverse guifg=lightgreen guibg=DarkGreen
205 autocmd GuiEnter * simalt ~x
206 set guifont=DejaVu_Sans_Mono:h8:cANSI:qDRAFT
208 " make all diff windows the same size
209 autocmd VimResized * wincmd =
210 autocmd VimEnter * 2wincmd w
211 autocmd VimEnter * syntax off
212 autocmd VimEnter * set guioptions+=b
216 if has("gui_running")
217 set lines=999 columns=120
219 " from /etc/vim/vimrc (restore last editing position)
221 au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
225 let &colorcolumn="121"
226 highlight ColorColumn ctermbg=lightgray guibg=lightcyan
231 " remove currently unused fugitive buffers:
232 autocmd BufReadPost fugitive://* set bufhidden=delete
234 " reset terminal colors after vim leaves
235 "if !has("gui_running")
236 " au VimLeave * !echo -ne "\033[0m"
239 " macht dass auch in screen auf dem server der vollstaendige hintergund gmalt
243 if has ('win32') || has('win32unix')
244 let g:vimwiki_list = [
246 \ 'path':'~/vimwiki',
247 \ 'path_html':'~/vimwiki/html/',
248 \ 'syntax': 'markdown',
253 let g:vimwiki_list = [
256 \ 'path_html':'~/p/wiki/html/',
257 \ 'syntax': 'markdown',
264 if isdirectory( b:vim_conf_dir . '/tmp/backup') == 0
265 call mkdir(b:vim_conf_dir.'/tmp/backup', 'p', 0700)
267 exec 'set backupdir='. b:vim_conf_dir.'/tmp/backup//'
270 " Save your swp files to a less annoying place than the current directory.
271 " If you have .vim-swap in the current directory, it'll use that.
272 " Otherwise it saves it to ~/.vim/swap, ~/tmp or .
273 if isdirectory( b:vim_conf_dir . '/tmp/swap') == 0
274 call mkdir(b:vim_conf_dir.'/tmp/swap', 'p', 0700)
276 exec 'set directory='. b:vim_conf_dir.'/tmp/swap//'
278 " viminfo stores the the state of your previous editing session
280 set viminfo+=n~/vimfiles/tmp/viminfo
282 set viminfo+=n~/.vim/tmp/viminfo
285 " letzte suche beim öffnen einer Datei sofort wieder anzeigen
288 if exists("+undofile")
289 " undofile - This allows you to use undos after exiting and restarting
290 " This, like swap and backups, uses .vim-undo first, then ~/.vim/undo
291 " :help undo-persistence
292 " This is only present in 7.3+
293 if isdirectory( b:vim_conf_dir . '/tmp/undo') == 0
294 call mkdir(b:vim_conf_dir.'/tmp/undo', 'p', 0700)
296 exec 'set undodir='. b:vim_conf_dir.'/tmp/undo'
301 function! FormatDocument()
302 let save_pos = getpos(".")
304 call setpos('.', save_pos)
308 noremap <Leader>x :call XmlPretty()<cr>
310 function! XmlPretty()
311 let save_pos = getpos(".")
314 :silent! %s/></>\r</g
317 call setpos('.', save_pos)
320 " fix logger stuff to use the newer api call
321 " remove #regions and whitspaces
322 " use {var} instead of " + var + "
323 noremap <Leader>fx ma:1,$ call FixCsharp()<cr>'a
324 function! FixCsharp()
325 let save_pos = getpos(".")
327 :silent! %g/^\s*#\(end\)\{0,1\}region/d
329 :silent! %g/\.WriteException(/normal 0df,$^iLog.Exception(
\eV=
330 :silent! %g/\.WriteMessage(/normal 0f(ldf."ayiw0P0xlveu0iLog.
\eelcf,(
\eld0$^PV=
332 " '+ varname +' durch '{varname}' ersetzen
333 :silent! %s/"\s*+\s*\(.\{-\}\)\s*+\s*"/{\1}/g
334 :silent! %s/"\s*+\s*\(.\{-\}\)\s*+\s*$/{\1}" +/g
335 :silent! %s/"\s*+\s*\(.\{-\}\)\s*);/{\1}");/g
337 "ersetze 'Zeilenanfang "'
338 :silent! %s/\(^\s*\)\("[^"]*{\)/\1$\2/g
339 :silent! %s/[^$]\(".*{\)/$\1/g
341 " mehrere leerzeilen durch eine einzelne ersetzen:
343 :silent! %s/\n\{3,}/\r\r/e
345 call setpos('.', save_pos)
348 function! FixWhitespace()
349 " convert tabs to spaces
351 " remove trailing whitespace
353 :silent! g/\s*<!--\**-->\s*/d
355 " remov '//******' and '//#####'
356 :silent! g/\/\/\(\*\|#\)*\s*$/d
357 " remove excessive newlines
358 :silent! %s/\n\n\n\+/
\r\r/
362 function! UndoCSharStringInterpolation()
364 silent! s/{\(.\{-}\)}/" + \1 + "/g
368 inoremap <F4> <Esc>:ALEToggle<CR>
369 nnoremap <F4> <Esc>:ALEToggle<CR>
370 let g:ale_linters = {
371 \ 'cpp': ['gcc', 'cppcheck', 'clang'],
372 \ 'perl': ['perl', 'perlcritic'],
374 let b:ale_warn_about_trailing_whitespace = 1
375 let g:ale_sign_column_always = 1
376 let g:ale_cpp_clang_options =
377 \ '-std=c++14 -Wall -pedantic -fPIC
378 \ -I/usr/include/x86_64-linux-gnu/qt5
379 \ -I/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport
380 \ -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets
381 \ -I/usr/include/x86_64-linux-gnu/qt5/QtGui
382 \ -I/usr/include/x86_64-linux-gnu/qt5/QtCore
383 \ -I/usr/include/libdrm
384 \ -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g+
387 let g:ale_cpp_gcc_options =
388 \ '-std=c++14 -Wall -pedantic -fPIC
389 \ -I/usr/include/x86_64-linux-gnu/qt5
390 \ -I/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport
391 \ -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets
392 \ -I/usr/include/x86_64-linux-gnu/qt5/QtGui
393 \ -I/usr/include/x86_64-linux-gnu/qt5/QtCore
394 \ -I/usr/include/libdrm
395 \ -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g+
400 if has("patch-7.4.354")
401 " Indents word-wrapped lines as much as the 'parent' line
403 " Ensures word-wrap does not split words
408 hi CursorLineNr ctermbg=black guibg=black
409 hi CursorLine ctermbg=black guibg=black
412 au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
413 au WinLeave * setlocal nocursorline
418 let g:acp_enableAtStartup = 1
419 let g:acp_behaviorPerlOmniLength = 0
420 let g:acp_behaviorPhpOmniLength = 0
421 let g:acp_completeoptPreview = 1
422 let g:acp_behaviorPythonOmniLength = 0
423 let g:acp_behaviorXmlOmniLength = 0
424 let g:acp_behaviorHtmlOmniLength = 0
425 let g:acp_behaviorCssOmniPropertyLength = 1
426 let g:acp_behaviorCssOmniValueLength = 0
428 highlight ExtraWhitespace ctermfg=red guifg=red ctermbg=white guibg=DarkGrey
430 " keine trailing whitespaces in hub log files anzeigen
431 match ExtraWhitespace /\s\+$/
433 let g:ale_python_flake8_options = "--max-line-length=120"
436 function! CopyFormatted(line1, line2)
437 let prev_number = &number
438 let prev_relativenumber = &relativenumber
439 let prev_background = &background
442 setlocal relativenumber!
443 setlocal background=light
444 " wenn ft manuel gesetzt war wird das von set background zurueckgesetzt, deswegen gleich wieder setzen
445 exe 'setlocal ft='.expand(prev_ft)
447 execute a:line1 . "," . a:line2 . "TOhtml"
449 !start /min powershell -noprofile "gcb | scb -as"
455 if (prev_relativenumber)
458 exe 'setlocal background='.expand(prev_background)
459 exe 'setlocal ft='.expand(prev_ft)
462 command! -range=% HtmlClip silent call CopyFormatted(<line1>,<line2>)