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 let g:neocomplete#enable_at_startup = 1
179 " ack seems to have vanished from artfull, thus use silversearchger-ag
182 let g:ackprg = 'ag --vimgrep'
185 set list listchars=tab:→\ ,trail:·
187 hi Visual guifg=White guibg=Blue gui=bold
189 set diffopt+=vertical
191 set diffopt+=algorithm:patience
192 "jump to next diff and center line
193 noremap <leader>n ]cz.
194 noremap <leader>p [cz.
197 set diffopt+=vertical
199 set diffopt+=algorithm:patience
202 autocmd GuiEnter * simalt ~x
203 " make all diff windows the same size
204 autocmd VimResized * wincmd =
205 autocmd VimEnter * 2wincmd w
206 autocmd VimEnter * syntax off
207 autocmd VimEnter * set guioptions+=b
211 if has("gui_running")
212 set lines=999 columns=120
214 " from /etc/vim/vimrc (restore last editing position)
216 au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
220 let &colorcolumn="121"
221 highlight ColorColumn ctermbg=lightgray guibg=lightcyan
225 " remove currently unused fugitive buffers:
226 autocmd BufReadPost fugitive://* set bufhidden=delete
228 autocmd GuiEnter * simalt ~x
230 " reset terminal colors after vim leaves
231 "if !has("gui_running")
232 " au VimLeave * !echo -ne "\033[0m"
235 " macht dass auch in screen auf dem server der vollstaendige hintergund gmalt
240 if has("gui_running")
242 set guifont=Consolas:h10:cANSI:qDRAFT
244 set guifont=Monospace\ 12
249 if has ('win32') || has('win32unix')
250 let g:vimwiki_list = [
252 \ 'path':'~/vimwiki',
253 \ 'path_html':'~/vimwiki/html/',
254 \ 'syntax': 'markdown',
259 let g:vimwiki_list = [
262 \ 'path_html':'~/p/wiki/html/',
263 \ 'syntax': 'markdown',
270 if isdirectory( b:vim_conf_dir . '/tmp/backup') == 0
271 call mkdir(b:vim_conf_dir.'/tmp/backup', 'p', 0700)
273 exec 'set backupdir='. b:vim_conf_dir.'/tmp/backup//'
276 " Save your swp files to a less annoying place than the current directory.
277 " If you have .vim-swap in the current directory, it'll use that.
278 " Otherwise it saves it to ~/.vim/swap, ~/tmp or .
279 if isdirectory( b:vim_conf_dir . '/tmp/swap') == 0
280 call mkdir(b:vim_conf_dir.'/tmp/swap', 'p', 0700)
282 exec 'set directory='. b:vim_conf_dir.'/tmp/swap//'
284 " viminfo stores the the state of your previous editing session
286 set viminfo+=n~/vimfiles/tmp/viminfo
288 set viminfo+=n~/.vim/tmp/viminfo
291 " letzte suche beim öffnen einer Datei sofort wieder anzeigen
294 if exists("+undofile")
295 " undofile - This allows you to use undos after exiting and restarting
296 " This, like swap and backups, uses .vim-undo first, then ~/.vim/undo
297 " :help undo-persistence
298 " This is only present in 7.3+
299 if isdirectory( b:vim_conf_dir . '/tmp/undo') == 0
300 call mkdir(b:vim_conf_dir.'/tmp/undo', 'p', 0700)
302 exec 'set undodir='. b:vim_conf_dir.'/tmp/undo'
307 function! FormatDocument()
308 let save_pos = getpos(".")
310 call setpos('.', save_pos)
314 noremap <Leader>x :call XmlPretty()<cr>
316 function! XmlPretty()
317 let save_pos = getpos(".")
320 :silent! %s/></>\r</g
323 call setpos('.', save_pos)
326 " fix logger stuff to use the newer api call
327 " remove #regions and whitspaces
328 " use {var} instead of " + var + "
329 noremap <Leader>fx ma:1,$ call FixCsharp()<cr>'a
330 function! FixCsharp()
331 let save_pos = getpos(".")
333 :silent! %g/^\s*#\(end\)\{0,1\}region/d
335 :silent! %g/\.WriteException(/normal 0df,$^iLog.Exception(
\eV=
336 :silent! %g/\.WriteMessage(/normal 0f(ldf."ayiw0P0xlveu0iLog.
\eelcf,(
\eld0$^PV=
338 " '+ varname +' durch '{varname}' ersetzen
339 :silent! %s/"\s*+\s*\(.\{-\}\)\s*+\s*"/{\1}/g
340 :silent! %s/"\s*+\s*\(.\{-\}\)\s*+\s*$/{\1}" +/g
341 :silent! %s/"\s*+\s*\(.\{-\}\)\s*);/{\1}");/g
343 "ersetze 'Zeilenanfang "'
344 :silent! %s/\(^\s*\)\("[^"]*{\)/\1$\2/g
345 :silent! %s/[^$]\(".*{\)/$\1/g
347 " mehrere leerzeilen durch eine einzelne ersetzen:
349 :silent! %s/\n\{3,}/\r\r/e
351 call setpos('.', save_pos)
354 function! FixWhitespace()
355 " convert tabs to spaces
357 " remove trailing whitespace
359 :silent! g/\s*<!--\**-->\s*/d
361 " remov '//******' and '//#####'
362 :silent! g/\/\/\(\*\|#\)*\s*$/d
363 " remove excessive newlines
364 :silent! %s/\n\n\n\+/
\r\r/
368 function! UndoCSharStringInterpolation()
370 silent! s/{\(.\{-}\)}/" + \1 + "/g
375 inoremap <F4> <Esc>:ALEToggle<CR>
376 nnoremap <F4> <Esc>:ALEToggle<CR>
377 let g:ale_linters = {
378 \ 'cpp': ['gcc', 'cppcheck', 'clang'],
380 let b:ale_warn_about_trailing_whitespace = 1
381 let g:ale_sign_column_always = 1
382 let g:ale_cpp_clang_options =
383 \ '-std=c++14 -Wall -pedantic -fPIC
384 \ -I/usr/include/x86_64-linux-gnu/qt5
385 \ -I/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport
386 \ -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets
387 \ -I/usr/include/x86_64-linux-gnu/qt5/QtGui
388 \ -I/usr/include/x86_64-linux-gnu/qt5/QtCore
389 \ -I/usr/include/libdrm
390 \ -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g+
393 let g:ale_cpp_gcc_options =
394 \ '-std=c++14 -Wall -pedantic -fPIC
395 \ -I/usr/include/x86_64-linux-gnu/qt5
396 \ -I/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport
397 \ -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets
398 \ -I/usr/include/x86_64-linux-gnu/qt5/QtGui
399 \ -I/usr/include/x86_64-linux-gnu/qt5/QtCore
400 \ -I/usr/include/libdrm
401 \ -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g+
406 if has("patch-7.4.354")
407 " Indents word-wrapped lines as much as the 'parent' line
409 " Ensures word-wrap does not split words
414 hi CursorLineNr term=underline cterm=underline ctermfg=White ctermbg=darkBlue guibg=darkyellow
416 "hi CursorLine gui=underline term=underline cterm=underline
419 au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
420 au WinLeave * setlocal nocursorline
425 let g:acp_enableAtStartup = 1
426 let g:acp_behaviorPerlOmniLength = 0
427 let g:acp_behaviorPhpOmniLength = 0
428 let g:acp_completeoptPreview = 1
429 let g:acp_behaviorPythonOmniLength = 0
430 let g:acp_behaviorXmlOmniLength = 0
431 let g:acp_behaviorHtmlOmniLength = 0
432 let g:acp_behaviorCssOmniPropertyLength = 1
433 let g:acp_behaviorCssOmniValueLength = 0
436 highlight ExtraWhitespace ctermfg=red guifg=red ctermbg=white guibg=DarkGrey
438 " keine trailing whitespaces in hub log files anzeigen
439 match ExtraWhitespace /\s\+$/
441 let g:ale_python_flake8_options = "--max-line-length=120"
444 function! CopyFormatted(line1, line2)
445 let prev_number = &number
446 let prev_relativenumber = &relativenumber
447 let prev_background = &background
450 setlocal relativenumber!
451 setlocal background=light
452 " wenn ft manuel gesetzt war wird das von set background zurueckgesetzt, deswegen gleich wieder setzen
453 exe 'setlocal ft='.expand(prev_ft)
455 execute a:line1 . "," . a:line2 . "TOhtml"
457 !start /min powershell -noprofile "gcb | scb -as"
463 if (prev_relativenumber)
466 exe 'setlocal background='.expand(prev_background)
467 exe 'setlocal ft='.expand(prev_ft)
470 command! -range=% HtmlClip silent call CopyFormatted(<line1>,<line2>)