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:deoplete#enable_at_startup = 1
178 call deoplete#custom#option({
179 \ 'auto_complete': v:true,
180 \ 'smart_case': v:true,
181 \ 'auto_complete_popup': 'auto'
185 " ack seems to have vanished from artfull, thus use silversearchger-ag
188 let g:ackprg = 'ag --vimgrep'
191 set list listchars=tab:→\ ,trail:·
193 hi Visual guifg=White guibg=Blue gui=bold
195 set diffopt+=vertical
197 set diffopt+=algorithm:patience
198 "jump to next diff and center line
199 noremap <leader>n ]cz.
200 noremap <leader>p [cz.
203 set diffopt+=vertical
205 set diffopt+=algorithm:patience
208 autocmd GuiEnter * simalt ~x
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
231 " remove currently unused fugitive buffers:
232 autocmd BufReadPost fugitive://* set bufhidden=delete
234 autocmd GuiEnter * simalt ~x
236 " reset terminal colors after vim leaves
237 "if !has("gui_running")
238 " au VimLeave * !echo -ne "\033[0m"
241 " macht dass auch in screen auf dem server der vollstaendige hintergund gmalt
246 if has("gui_running")
248 set guifont=Consolas:h10:cANSI:qDRAFT
250 set guifont=Monospace\ 12
255 if has ('win32') || has('win32unix')
256 let g:vimwiki_list = [
258 \ 'path':'~/vimwiki',
259 \ 'path_html':'~/vimwiki/html/',
260 \ 'syntax': 'markdown',
265 let g:vimwiki_list = [
268 \ 'path_html':'~/p/wiki/html/',
269 \ 'syntax': 'markdown',
276 if isdirectory( b:vim_conf_dir . '/tmp/backup') == 0
277 call mkdir(b:vim_conf_dir.'/tmp/backup', 'p', 0700)
279 exec 'set backupdir='. b:vim_conf_dir.'/tmp/backup//'
282 " Save your swp files to a less annoying place than the current directory.
283 " If you have .vim-swap in the current directory, it'll use that.
284 " Otherwise it saves it to ~/.vim/swap, ~/tmp or .
285 if isdirectory( b:vim_conf_dir . '/tmp/swap') == 0
286 call mkdir(b:vim_conf_dir.'/tmp/swap', 'p', 0700)
288 exec 'set directory='. b:vim_conf_dir.'/tmp/swap//'
290 " viminfo stores the the state of your previous editing session
292 set viminfo+=n~/vimfiles/tmp/viminfo
294 set viminfo+=n~/.vim/tmp/viminfo
297 " letzte suche beim öffnen einer Datei sofort wieder anzeigen
300 if exists("+undofile")
301 " undofile - This allows you to use undos after exiting and restarting
302 " This, like swap and backups, uses .vim-undo first, then ~/.vim/undo
303 " :help undo-persistence
304 " This is only present in 7.3+
305 if isdirectory( b:vim_conf_dir . '/tmp/undo') == 0
306 call mkdir(b:vim_conf_dir.'/tmp/undo', 'p', 0700)
308 exec 'set undodir='. b:vim_conf_dir.'/tmp/undo'
313 function! FormatDocument()
314 let save_pos = getpos(".")
316 call setpos('.', save_pos)
320 noremap <Leader>x :call XmlPretty()<cr>
322 function! XmlPretty()
323 let save_pos = getpos(".")
326 :silent! %s/></>\r</g
329 call setpos('.', save_pos)
332 " fix logger stuff to use the newer api call
333 " remove #regions and whitspaces
334 " use {var} instead of " + var + "
335 noremap <Leader>fx ma:1,$ call FixCsharp()<cr>'a
336 function! FixCsharp()
337 let save_pos = getpos(".")
339 :silent! %g/^\s*#\(end\)\{0,1\}region/d
341 :silent! %g/\.WriteException(/normal 0df,$^iLog.Exception(
\eV=
342 :silent! %g/\.WriteMessage(/normal 0f(ldf."ayiw0P0xlveu0iLog.
\eelcf,(
\eld0$^PV=
344 " '+ varname +' durch '{varname}' ersetzen
345 :silent! %s/"\s*+\s*\(.\{-\}\)\s*+\s*"/{\1}/g
346 :silent! %s/"\s*+\s*\(.\{-\}\)\s*+\s*$/{\1}" +/g
347 :silent! %s/"\s*+\s*\(.\{-\}\)\s*);/{\1}");/g
349 "ersetze 'Zeilenanfang "'
350 :silent! %s/\(^\s*\)\("[^"]*{\)/\1$\2/g
351 :silent! %s/[^$]\(".*{\)/$\1/g
353 " mehrere leerzeilen durch eine einzelne ersetzen:
355 :silent! %s/\n\{3,}/\r\r/e
357 call setpos('.', save_pos)
360 function! FixWhitespace()
361 " convert tabs to spaces
363 " remove trailing whitespace
365 :silent! g/\s*<!--\**-->\s*/d
367 " remov '//******' and '//#####'
368 :silent! g/\/\/\(\*\|#\)*\s*$/d
369 " remove excessive newlines
370 :silent! %s/\n\n\n\+/
\r\r/
374 function! UndoCSharStringInterpolation()
376 silent! s/{\(.\{-}\)}/" + \1 + "/g
381 inoremap <F4> <Esc>:ALEToggle<CR>
382 nnoremap <F4> <Esc>:ALEToggle<CR>
383 let g:ale_linters = {
384 \ 'cpp': ['gcc', 'cppcheck', 'clang'],
386 let b:ale_warn_about_trailing_whitespace = 1
387 let g:ale_sign_column_always = 1
388 let g:ale_cpp_clang_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+
399 let g:ale_cpp_gcc_options =
400 \ '-std=c++14 -Wall -pedantic -fPIC
401 \ -I/usr/include/x86_64-linux-gnu/qt5
402 \ -I/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport
403 \ -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets
404 \ -I/usr/include/x86_64-linux-gnu/qt5/QtGui
405 \ -I/usr/include/x86_64-linux-gnu/qt5/QtCore
406 \ -I/usr/include/libdrm
407 \ -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g+
412 if has("patch-7.4.354")
413 " Indents word-wrapped lines as much as the 'parent' line
415 " Ensures word-wrap does not split words
420 hi CursorLineNr term=underline cterm=underline ctermfg=White ctermbg=darkBlue guibg=darkyellow
422 "hi CursorLine gui=underline term=underline cterm=underline
425 au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
426 au WinLeave * setlocal nocursorline
431 let g:acp_enableAtStartup = 1
432 let g:acp_behaviorPerlOmniLength = 0
433 let g:acp_behaviorPhpOmniLength = 0
434 let g:acp_completeoptPreview = 1
435 let g:acp_behaviorPythonOmniLength = 0
436 let g:acp_behaviorXmlOmniLength = 0
437 let g:acp_behaviorHtmlOmniLength = 0
438 let g:acp_behaviorCssOmniPropertyLength = 1
439 let g:acp_behaviorCssOmniValueLength = 0
442 highlight ExtraWhitespace ctermfg=red guifg=red ctermbg=white guibg=DarkGrey
444 " keine trailing whitespaces in hub log files anzeigen
445 match ExtraWhitespace /\s\+$/
447 let g:ale_python_flake8_options = "--max-line-length=120"
450 function! CopyFormatted(line1, line2)
451 let prev_number = &number
452 let prev_relativenumber = &relativenumber
453 let prev_background = &background
456 setlocal relativenumber!
457 setlocal background=light
458 " wenn ft manuel gesetzt war wird das von set background zurueckgesetzt, deswegen gleich wieder setzen
459 exe 'setlocal ft='.expand(prev_ft)
461 execute a:line1 . "," . a:line2 . "TOhtml"
463 !start /min powershell -noprofile "gcb | scb -as"
469 if (prev_relativenumber)
472 exe 'setlocal background='.expand(prev_background)
473 exe 'setlocal ft='.expand(prev_ft)
476 command! -range=% HtmlClip silent call CopyFormatted(<line1>,<line2>)