2 let b:vim_conf_dir = $HOME.'/.vim'
4 let b:vim_conf_dir = $HOME.'\vimfiles'
7 if isdirectory( b:vim_conf_dir . '/tmp/') == 0
8 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
58 " Tab-completion in command-line mode
62 set wildignore=*.pdf,*.fo,
75 " remove =, thus 'gf' works whit filepath asignemens like myvar=/path/tofile
78 let perl_include_pod = 1
81 autocmd FileType perl setlocal complete-=i
96 nnoremap <Leader>i a'" << << "' <Esc>6hi
97 nnoremap <Leader>a a'{}' <Esc>2hi
98 nnoremap <Leader>A a'"+ +"' <Esc>4hi
100 nnoremap <Leader>A a'"+ +"' <Esc>4hi
102 " see :h restore-position
103 nnoremap <Leader>= msHmp=iB'pzt`s
107 inoremap ts<tab> // TODOts: <Esc>=$A
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 <C-l> <C-W>l
130 " Copy paste to/from system clipboard
132 inoremap <C-S-v> <esc>"*p
136 "nnoremap <Leader>= mzgg=G`z<CR>
137 nnoremap <F2> :call FormatDocument()<CR>
139 cmap w!! w !sudo tee > /dev/null %
141 "move visually selected
143 vnoremap <M-j> :m '>+1<CR>gv=gv
144 vnoremap <M-k> :m '<-2<CR>gv=gv
145 nnoremap <M-k> :m -2<CR>==
146 nnoremap <M-j> :m +1<CR>==
148 " repeat last command on all selected:
149 vnoremap . :normal.<CR>
152 "vnoremap <leader>tt :Tabular /^[^=]*\zs\S*=/l1l2<cr>
153 vnoremap <leader>tt :Tabular /^[^-+=]*\zs\S*=/l1l2<cr>
154 vnoremap <leader>t, :Tabular /,\zs/l1l1<cr>
155 vnoremap <leader>t<space> :Tabular /\s\+\zs/l1l1<cr>
156 vnoremap <leader>t( :Tabular /(/l1l0<cr>
157 vnoremap <leader>t: :Tabular /:/r0c1l0<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>
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.
195 set diffopt+=vertical
197 set diffopt+=algorithm:patience
200 autocmd GuiEnter * simalt ~x
201 " make all diff windows the same size
202 autocmd VimResized * wincmd =
203 autocmd VimEnter * 2wincmd w
204 autocmd VimEnter * syntax off
205 autocmd VimEnter * set guioptions+=b
209 if has("gui_running")
210 set lines=999 columns=120
212 " from /etc/vim/vimrc (restore last editing position)
214 au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
218 let &colorcolumn="121"
219 highlight ColorColumn ctermbg=lightgray guibg=lightcyan
223 " remove currently unused fugitive buffers:
224 autocmd BufReadPost fugitive://* set bufhidden=delete
226 autocmd GuiEnter * simalt ~x
228 " reset terminal colors after vim leaves
229 "if !has("gui_running")
230 " au VimLeave * !echo -ne "\033[0m"
233 " macht dass auch in screen auf dem server der vollstaendige hintergund gmalt
238 if has("gui_running")
240 set guifont=Consolas:h10:cANSI:qDRAFT
242 set guifont=Monospace\ 12
247 if has ('win32') || has('win32unix')
248 let g:vimwiki_list = [
250 \ 'path':'~/vimwiki',
251 \ 'path_html':'~/vimwiki/html/',
252 \ 'syntax': 'markdown',
257 let g:vimwiki_list = [
260 \ 'path_html':'~/p/wiki/html/',
261 \ 'syntax': 'markdown',
268 if isdirectory( b:vim_conf_dir . '/tmp/backup') == 0
269 call mkdir(b:vim_conf_dir.'/tmp/backup', 'p', 0700)
271 exec 'set backupdir='. b:vim_conf_dir.'/tmp/backup//'
274 " Save your swp files to a less annoying place than the current directory.
275 " If you have .vim-swap in the current directory, it'll use that.
276 " Otherwise it saves it to ~/.vim/swap, ~/tmp or .
277 if isdirectory( b:vim_conf_dir . '/tmp/swap') == 0
278 call mkdir(b:vim_conf_dir.'/tmp/swap', 'p', 0700)
280 exec 'set directory='. b:vim_conf_dir.'/tmp/swap//'
282 " viminfo stores the the state of your previous editing session
284 set viminfo+=n~/vimfiles/tmp/viminfo
286 set viminfo+=n~/.vim/tmp/viminfo
289 " letzte suche beim öffnen einer Datei sofort wieder anzeigen
292 if exists("+undofile")
293 " undofile - This allows you to use undos after exiting and restarting
294 " This, like swap and backups, uses .vim-undo first, then ~/.vim/undo
295 " :help undo-persistence
296 " This is only present in 7.3+
297 if isdirectory( b:vim_conf_dir . '/tmp/undo') == 0
298 call mkdir(b:vim_conf_dir.'/tmp/undo', 'p', 0700)
300 exec 'set undodir='. b:vim_conf_dir.'/tmp/undo'
305 function! FormatDocument()
306 let save_pos = getpos(".")
308 call setpos('.', save_pos)
312 noremap <Leader>x :call XmlPretty()<cr>
314 function! XmlPretty()
315 let save_pos = getpos(".")
318 :silent! %s/></>\r</g
321 call setpos('.', save_pos)
324 " fix logger stuff to use the newer api call
325 " remove #regions and whitspaces
326 " use {var} instead of " + var + "
327 noremap <Leader>fx ma:1,$ call FixCsharp()<cr>'a
328 function! FixCsharp()
329 let save_pos = getpos(".")
331 :silent! %g/^\s*#\(end\)\{0,1\}region/d
333 :silent! %g/\.WriteException(/normal 0df,$^iLog.Exception(
\eV=
334 :silent! %g/\.WriteMessage(/normal 0f(ldf."ayiw0P0xlveu0iLog.
\eelcf,(
\eld0$^PV=
336 " '+ varname +' durch '{varname}' ersetzen
337 :silent! %s/"\s*+\s*\(.\{-\}\)\s*+\s*"/{\1}/g
338 :silent! %s/"\s*+\s*\(.\{-\}\)\s*+\s*$/{\1}" +/g
339 :silent! %s/"\s*+\s*\(.\{-\}\)\s*);/{\1}");/g
341 "ersetze 'Zeilenanfang "'
342 :silent! %s/\(^\s*\)\("[^"]*{\)/\1$\2/g
343 :silent! %s/[^$]\(".*{\)/$\1/g
345 " mehrere leerzeilen durch eine einzelne ersetzen:
347 :silent! %s/\n\{3,}/\r\r/e
349 call setpos('.', save_pos)
352 function! FixWhitespace()
353 " convert tabs to spaces
355 " remove trailing whitespace
357 :silent! g/\s*<!--\**-->\s*/d
359 " remov '//******' and '//#####'
360 :silent! g/\/\/\(\*\|#\)*\s*$/d
361 " remove excessive newlines
362 :silent! %s/\n\n\n\+/
\r\r/
366 function! UndoCSharStringInterpolation()
368 silent! s/{\(.\{-}\)}/" + \1 + "/g
373 inoremap <F4> <Esc>:ALEToggle<CR>
374 nnoremap <F4> <Esc>:ALEToggle<CR>
375 let g:ale_linters = {
376 \ 'cpp': ['gcc', 'cppcheck', 'clang'],
378 let b:ale_warn_about_trailing_whitespace = 1
379 let g:ale_sign_column_always = 1
380 let g:ale_cpp_clang_options =
381 \ '-std=c++14 -Wall -pedantic -fPIC
382 \ -I/usr/include/x86_64-linux-gnu/qt5
383 \ -I/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport
384 \ -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets
385 \ -I/usr/include/x86_64-linux-gnu/qt5/QtGui
386 \ -I/usr/include/x86_64-linux-gnu/qt5/QtCore
387 \ -I/usr/include/libdrm
388 \ -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g+
391 let g:ale_cpp_gcc_options =
392 \ '-std=c++14 -Wall -pedantic -fPIC
393 \ -I/usr/include/x86_64-linux-gnu/qt5
394 \ -I/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport
395 \ -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets
396 \ -I/usr/include/x86_64-linux-gnu/qt5/QtGui
397 \ -I/usr/include/x86_64-linux-gnu/qt5/QtCore
398 \ -I/usr/include/libdrm
399 \ -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g+
404 if has("patch-7.4.354")
405 " Indents word-wrapped lines as much as the 'parent' line
407 " Ensures word-wrap does not split words
412 hi CursorLineNr term=underline cterm=underline ctermfg=White ctermbg=darkBlue guibg=darkyellow
414 "hi CursorLine gui=underline term=underline cterm=underline
417 au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
418 au WinLeave * setlocal nocursorline
423 let g:acp_enableAtStartup = 1
424 let g:acp_behaviorPerlOmniLength = 0
425 let g:acp_behaviorPhpOmniLength = 0
426 let g:acp_completeoptPreview = 1
427 let g:acp_behaviorPythonOmniLength = 0
428 let g:acp_behaviorXmlOmniLength = 0
429 let g:acp_behaviorHtmlOmniLength = 0
430 let g:acp_behaviorCssOmniPropertyLength = 1
431 let g:acp_behaviorCssOmniValueLength = 0
434 highlight ExtraWhitespace ctermfg=red guifg=red ctermbg=white guibg=DarkGrey
436 " keine trailing whitespaces in hub log files anzeigen
437 match ExtraWhitespace /\s\+$/
439 let g:ale_python_flake8_options = "--max-line-length=120"
442 function! CopyFormatted(line1, line2)
443 let prev_number = &number
444 let prev_relativenumber = &relativenumber
445 let prev_background = &background
448 setlocal relativenumber!
449 setlocal background=light
450 " wenn ft manuel gesetzt war wird das von set background zurueckgesetzt, deswegen gleich wieder setzen
451 exe 'setlocal ft='.expand(prev_ft)
453 execute a:line1 . "," . a:line2 . "TOhtml"
455 !start /min powershell -noprofile "gcb | scb -as"
461 if (prev_relativenumber)
464 exe 'setlocal background='.expand(prev_background)
465 exe 'setlocal ft='.expand(prev_ft)
468 command! -range=% HtmlClip silent call CopyFormatted(<line1>,<line2>)