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>= msgg=G`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*=/l1l1<cr>
153 vnoremap <leader>t, :Tabular /,\zs/l1l1<cr>
154 vnoremap <leader>t<space> :Tabular /\s\+\zs/l1l1<cr>
155 vnoremap <leader>t( :Tabular /(/l1l0<cr>
156 vnoremap <leader>t: :Tabular /:/r0c1l0<cr>
158 " append word under cursor with 'or' to current search pattern
159 nnoremap <Leader>s yiw/<C-R>/\\|<C-R>"<cr>
160 " append selection with 'or' to current search pattern
161 vnoremap <Leader>s y/<C-R>/\\|<C-R>"<cr>
163 cmap w!! w !sudo tee % >/dev/null
164 nnoremap <Leader>mh :wa<CR>:silent !mhsend -run reload code<CR>:redraw!<CR>
165 nnoremap <Leader>ll iprint_log("");<Esc>V=0f(la
168 nnoremap <Leader>r :source ~/vimfiles/vimrc<CR>
170 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.
194 set diffopt+=vertical
196 set diffopt+=algorithm:patience
199 autocmd GuiEnter * simalt ~x
200 " make all diff windows the same size
201 autocmd VimResized * wincmd =
202 autocmd VimEnter * 2wincmd w
203 autocmd VimEnter * syntax off
204 autocmd VimEnter * set guioptions+=b
208 if has("gui_running")
209 set lines=999 columns=120
211 " from /etc/vim/vimrc (restore last editing position)
213 au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
217 let &colorcolumn="121"
218 highlight ColorColumn ctermbg=lightgray guibg=lightcyan
222 " remove currently unused fugitive buffers:
223 autocmd BufReadPost fugitive://* set bufhidden=delete
225 autocmd GuiEnter * simalt ~x
227 " reset terminal colors after vim leaves
228 "if !has("gui_running")
229 " au VimLeave * !echo -ne "\033[0m"
232 " macht dass auch in screen auf dem server der vollstaendige hintergund gmalt
237 if has("gui_running")
239 set guifont=Consolas:h10:cANSI:qDRAFT
241 set guifont=Monospace\ 12
246 if has ('win32') || has('win32unix')
247 let g:vimwiki_list = [
249 \ 'path':'~/vimwiki',
250 \ 'path_html':'~/vimwiki/html/',
251 \ 'syntax': 'markdown',
256 let g:vimwiki_list = [
259 \ 'path_html':'~/p/wiki/html/',
260 \ 'syntax': 'markdown',
267 if isdirectory( b:vim_conf_dir . '/tmp/backup') == 0
268 call mkdir(b:vim_conf_dir.'/tmp/backup', 'p', 0700)
270 exec 'set backupdir='. b:vim_conf_dir.'/tmp/backup//'
273 " Save your swp files to a less annoying place than the current directory.
274 " If you have .vim-swap in the current directory, it'll use that.
275 " Otherwise it saves it to ~/.vim/swap, ~/tmp or .
276 if isdirectory( b:vim_conf_dir . '/tmp/swap') == 0
277 call mkdir(b:vim_conf_dir.'/tmp/swap', 'p', 0700)
279 exec 'set directory='. b:vim_conf_dir.'/tmp/swap//'
281 " viminfo stores the the state of your previous editing session
283 set viminfo+=n~/vimfiles/tmp/viminfo
285 set viminfo+=n~/.vim/tmp/viminfo
288 " letzte suche beim öffnen einer Datei sofort wieder anzeigen
291 if exists("+undofile")
292 " undofile - This allows you to use undos after exiting and restarting
293 " This, like swap and backups, uses .vim-undo first, then ~/.vim/undo
294 " :help undo-persistence
295 " This is only present in 7.3+
296 if isdirectory( b:vim_conf_dir . '/tmp/undo') == 0
297 call mkdir(b:vim_conf_dir.'/tmp/undo', 'p', 0700)
299 exec 'set undodir='. b:vim_conf_dir.'/tmp/undo'
304 function! FormatDocument()
305 let save_pos = getpos(".")
307 call setpos('.', save_pos)
311 noremap <Leader>x :call XmlPretty()<cr>
313 function! XmlPretty()
314 let save_pos = getpos(".")
317 :silent! %s/></>\r</g
320 call setpos('.', save_pos)
323 " fix logger stuff to use the newer api call
324 " remove #regions and whitspaces
325 " use {var} instead of " + var + "
326 noremap <Leader>fx ma:1,$ call FixCsharp()<cr>'a
327 function! FixCsharp()
328 let save_pos = getpos(".")
330 :silent! %g/^\s*#\(end\)\{0,1\}region/d
332 :silent! %g/\.WriteException(/normal 0df,$^iLog.Exception(
\eV=
333 :silent! %g/\.WriteMessage(/normal 0f(ldf."ayiw0P0xlveu0iLog.
\eelcf,(
\eld0$^PV=
335 " '+ varname +' durch '{varname}' ersetzen
336 :silent! %s/"\s*+\s*\(.\{-\}\)\s*+\s*"/{\1}/g
337 :silent! %s/"\s*+\s*\(.\{-\}\)\s*+\s*$/{\1}" +/g
338 :silent! %s/"\s*+\s*\(.\{-\}\)\s*);/{\1}");/g
340 "ersetze 'Zeilenanfang "'
341 :silent! %s/\(^\s*\)\("[^"]*{\)/\1$\2/g
342 :silent! %s/[^$]\(".*{\)/$\1/g
344 " mehrere leerzeilen durch eine einzelne ersetzen:
346 :silent! %s/\n\{3,}/\r\r/e
348 call setpos('.', save_pos)
351 function! FixWhitespace()
352 " convert tabs to spaces
354 " remove trailing whitespace
356 :silent! g/\s*<!--\**-->\s*/d
358 " remov '//******' and '//#####'
359 :silent! g/\/\/\(\*\|#\)*\s*$/d
360 " remove excessive newlines
361 :silent! %s/\n\n\n\+/
\r\r/
365 function! UndoCSharStringInterpolation()
367 silent! s/{\(.\{-}\)}/" + \1 + "/g
372 inoremap <F4> <Esc>:ALEToggle<CR>
373 nnoremap <F4> <Esc>:ALEToggle<CR>
374 let g:ale_linters = {
375 \ 'cpp': ['gcc', 'cppcheck', 'clang'],
377 let b:ale_warn_about_trailing_whitespace = 1
378 let g:ale_sign_column_always = 1
379 let g:ale_cpp_clang_options =
380 \ '-std=c++14 -Wall -pedantic -fPIC
381 \ -I/usr/include/x86_64-linux-gnu/qt5
382 \ -I/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport
383 \ -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets
384 \ -I/usr/include/x86_64-linux-gnu/qt5/QtGui
385 \ -I/usr/include/x86_64-linux-gnu/qt5/QtCore
386 \ -I/usr/include/libdrm
387 \ -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g+
390 let g:ale_cpp_gcc_options =
391 \ '-std=c++14 -Wall -pedantic -fPIC
392 \ -I/usr/include/x86_64-linux-gnu/qt5
393 \ -I/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport
394 \ -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets
395 \ -I/usr/include/x86_64-linux-gnu/qt5/QtGui
396 \ -I/usr/include/x86_64-linux-gnu/qt5/QtCore
397 \ -I/usr/include/libdrm
398 \ -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g+
403 if has("patch-7.4.354")
404 " Indents word-wrapped lines as much as the 'parent' line
406 " Ensures word-wrap does not split words
411 hi CursorLineNr term=underline cterm=underline ctermfg=White ctermbg=darkBlue guibg=darkyellow
413 "hi CursorLine gui=underline term=underline cterm=underline
416 au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
417 au WinLeave * setlocal nocursorline
422 let g:acp_enableAtStartup = 1
423 let g:acp_behaviorPerlOmniLength = 0
424 let g:acp_behaviorPhpOmniLength = 0
425 let g:acp_completeoptPreview = 1
426 let g:acp_behaviorPythonOmniLength = 0
427 let g:acp_behaviorXmlOmniLength = 0
428 let g:acp_behaviorHtmlOmniLength = 0
429 let g:acp_behaviorCssOmniPropertyLength = 1
430 let g:acp_behaviorCssOmniValueLength = 0
433 highlight ExtraWhitespace ctermfg=red guifg=red ctermbg=white guibg=DarkGrey
435 " keine trailing whitespaces in hub log files anzeigen
436 match ExtraWhitespace /\s\+$/
438 let g:ale_python_flake8_options = "--max-line-length=120"
441 function! CopyFormatted(line1, line2)
442 let prev_number = &number
443 let prev_relativenumber = &relativenumber
444 let prev_background = &background
447 setlocal relativenumber!
448 setlocal background=light
449 " wenn ft manuel gesetzt war wird das von set background zurueckgesetzt, deswegen gleich wieder setzen
450 exe 'setlocal ft='.expand(prev_ft)
452 execute a:line1 . "," . a:line2 . "TOhtml"
454 !start /min powershell -noprofile "gcb | scb -as"
460 if (prev_relativenumber)
463 exe 'setlocal background='.expand(prev_background)
464 exe 'setlocal ft='.expand(prev_ft)
467 command! -range=% HtmlClip silent call CopyFormatted(<line1>,<line2>)