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 set backspace=indent,eol,start
45 " Tab-completion in command-line mode
49 set wildignore=*.pdf,*.fo,
62 " remove =, thus 'gf' works whit filepath asignemens like myvar=/path/tofile
65 let perl_include_pod = 1
68 autocmd FileType perl setlocal complete-=i
83 nnoremap <Leader>i a'" << << "' <Esc>6hi
84 nnoremap <Leader>a a'{}' <Esc>2hi
85 nnoremap <Leader>A a'"+ +"' <Esc>4hi
87 nnoremap <Leader>A a'"+ +"' <Esc>4hi
89 " see :h restore-position
90 nnoremap <Leader>= msHmp=iB'pzt`s
94 inoremap ts<tab> // TODOts: <Esc>=$A
95 inoremap no<tab> <Esc>0i <nodoc /><Esc>0i///<Esc>=$
96 inoremap td<tab> <Esc>0i//TODOts: doku<CR><summary> </summary><Esc>0i/// <Esc>kVj=$
98 autocmd InsertEnter * set timeoutlen=500
99 autocmd InsertLeave * set timeoutlen=1000
101 inoremap in<tab> <Esc>0i<inheritdoc /><Esc>0i///<Esc>V=
106 nnoremap <C-p> :bprev<CR>
107 nnoremap <C-n> :bnext<CR>
109 nnoremap <leader>e :tabedit $MYVIMRC<CR>
111 nnoremap ZZ :wqall<CR>
112 nnoremap <F6> :wa<CR>:make -j 8<CR><CR>
113 inoremap <F6> <esc>:wa<CR>:make -j 8<CR><CR>
115 nnoremap <C-l> <C-W>l
117 " Copy paste to/from system clipboard
119 inoremap <C-S-v> <esc>"*p
123 "nnoremap <Leader>= mzgg=G`z<CR>
124 nnoremap <F2> :call FormatDocument()<CR>
126 cmap w!! w !sudo tee > /dev/null %
128 "move visually selected
130 vnoremap <M-j> :m '>+1<CR>gv=gv
131 vnoremap <M-k> :m '<-2<CR>gv=gv
132 nnoremap <M-k> :m -2<CR>==
133 nnoremap <M-j> :m +1<CR>==
135 " repeat last command on all selected:
136 vnoremap . :normal.<CR>
139 "vnoremap <leader>tt :Tabular /^[^=]*\zs\S*=/l1l2<cr>
140 vnoremap <leader>tt :Tabular /^[^-+=]*\zs\S*=/l1l2<cr>
141 vnoremap <leader>t, :Tabular /,\zs/l1l1<cr>
142 vnoremap <leader>t<space> :Tabular /\s\+\zs/l1l1<cr>
143 vnoremap <leader>t( :Tabular /(/l1l0<cr>
144 vnoremap <leader>t: :Tabular /:/r0c1l0<cr>
146 " append word under cursor with 'or' to current search pattern
147 nnoremap <Leader>s yiw/<C-R>/\\|<C-R>"<cr>
148 " append selection with 'or' to current search pattern
149 vnoremap <Leader>s y/<C-R>/\\|<C-R>"<cr>
151 cmap w!! w !sudo tee % >/dev/null
152 nnoremap <Leader>mh :wa<CR>:silent !mhsend -run reload code<CR>:redraw!<CR>
153 nnoremap <Leader>ll iprint_log("");<Esc>V=0f(la
156 nnoremap <Leader>r :source ~/vimfiles/vimrc<CR>
158 nnoremap <Leader>r :source ~/.vim/vimrc<CR>
162 filetype plugin indent on
164 let g:neocomplete#enable_at_startup = 1
166 " ack seems to have vanished from artfull, thus use silversearchger-ag
169 let g:ackprg = 'ag --vimgrep'
172 set list listchars=tab:→\ ,trail:·
175 set diffopt+=vertical
177 set diffopt+=algorithm:patience
178 "jump to next diff and center line
179 noremap <leader>n ]cz.
180 noremap <leader>p [cz.
183 set diffopt+=vertical
185 set diffopt+=algorithm:patience
188 autocmd GuiEnter * simalt ~x
189 " make all diff windows the same size
190 autocmd VimResized * wincmd =
191 autocmd VimEnter * 2wincmd w
192 autocmd VimEnter * syntax off
193 autocmd VimEnter * set guioptions+=b
198 if has("gui_running")
199 set lines=999 columns=120
201 " from /etc/vim/vimrc (restore last editing position)
203 au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif
207 " remove currently unused fugitive buffers:
208 autocmd BufReadPost fugitive://* set bufhidden=delete
210 autocmd GuiEnter * simalt ~x
212 " reset terminal colors after vim leaves
213 "if !has("gui_running")
214 " au VimLeave * !echo -ne "\033[0m"
217 " macht dass auch in screen auf dem server der vollstaendige hintergund gmalt
222 if has("gui_running")
224 set guifont=Consolas:h10:cANSI:qDRAFT
226 set guifont=Monospace\ 12
231 if has ('win32') || has('win32unix')
232 let g:vimwiki_list = [
234 \ 'path':'~/vimwiki',
235 \ 'path_html':'~/vimwiki/html/',
236 \ 'syntax': 'markdown',
241 let g:vimwiki_list = [
244 \ 'path_html':'~/p/wiki/html/',
245 \ 'syntax': 'markdown',
252 if isdirectory( b:vim_conf_dir . '/tmp/backup') == 0
253 call mkdir(b:vim_conf_dir.'/tmp/backup', 'p', 0700)
255 exec 'set backupdir='. b:vim_conf_dir.'/tmp/backup//'
258 " Save your swp files to a less annoying place than the current directory.
259 " If you have .vim-swap in the current directory, it'll use that.
260 " Otherwise it saves it to ~/.vim/swap, ~/tmp or .
261 if isdirectory( b:vim_conf_dir . '/tmp/swap') == 0
262 call mkdir(b:vim_conf_dir.'/tmp/swap', 'p', 0700)
264 exec 'set directory='. b:vim_conf_dir.'/tmp/swap//'
266 " viminfo stores the the state of your previous editing session
268 set viminfo+=n~/vimfiles/tmp/viminfo
270 set viminfo+=n~/.vim/tmp/viminfo
273 " letzte suche beim öffnen einer Datei sofort wieder anzeigen
276 if exists("+undofile")
277 " undofile - This allows you to use undos after exiting and restarting
278 " This, like swap and backups, uses .vim-undo first, then ~/.vim/undo
279 " :help undo-persistence
280 " This is only present in 7.3+
281 if isdirectory( b:vim_conf_dir . '/tmp/undo') == 0
282 call mkdir(b:vim_conf_dir.'/tmp/undo', 'p', 0700)
284 exec 'set undodir='. b:vim_conf_dir.'/tmp/undo'
289 function! FormatDocument()
290 let save_pos = getpos(".")
292 call setpos('.', save_pos)
296 noremap <Leader>x :call XmlPretty()<cr>
298 function! XmlPretty()
299 let save_pos = getpos(".")
302 :silent! %s/></>\r</g
305 call setpos('.', save_pos)
308 " fix logger stuff to use the newer api call
309 " remove #regions and whitspaces
310 " use {var} instead of " + var + "
311 noremap <Leader>fx ma:1,$ call FixCsharp()<cr>'a
312 function! FixCsharp() range
313 let save_pos = getpos(".")
315 :silent! execute a:firstline.",".a:lastline.'g/^\s*#\(end\)\{0,1\}region/d'
316 " mehrere leerzeilen durch eine einzelne ersetzen:
317 :silent! execute a:firstline.",".a:lastline.'s/\s\+$//e'
318 :silent! execute a:firstline.",".a:lastline.'s/\n\{3,}/\r\r/e'
320 silent! execute a:firstline.",".a:lastline.'g/\.WriteException(/normal 0df,$^iLog.Exception(
\eV='
321 silent! execute a:firstline.",".a:lastline.'g/\.WriteMessage(/normal 0f(ldf."ayiw0P0xlveu0iLog.
\eelcf,(
\eld0$^PV='
323 " '+ varname +' durch '{varname}' ersetzen
324 silent! execute a:firstline.",".a:lastline.'s/"\s*+\s*\(.\{-\}\)\s*+\s*"/{\1}/g'
325 silent! execute a:firstline.",".a:lastline.'s/"\s*+\s*\(.\{-\}\)\s*+\s*$/{\1}" +/g'
326 silent! execute a:firstline.",".a:lastline.'s/"\s*+\s*\(.\{-\}\)\s*);/{\1}");/g'
327 "ersetze log...(rank, "
328 silent! execute a:firstline.",".a:lastline.'s/,\s*\("[^"]*{\)/, $\1/c'
329 "ersetze 'Zeilenanfang "'
330 silent! execute a:firstline.",".a:lastline.'s/\(^\s*\)\("[^"]*{\)/\1$\2/c'
331 silent! execute a:firstline.",".a:lastline.'s/[^$]\(".*{\)/$\1/c'
333 call setpos('.', save_pos)
336 function! FixWhitespace()
337 " convert tabs to spaces
339 " remove trailing whitespace
341 :silent! g/\s*<!--\**-->\s*/d
343 " remov '//******' and '//#####'
344 :silent! g/\/\/\(\*\|#\)*\s*$/d
345 " remove excessive newlines
346 :silent! %s/\n\n\n\+/
\r\r/
349 function! UndoCSharStringInterpolation()
351 silent! s/{\(.\{-}\)}/" + \1 + "/g
356 inoremap <F4> <Esc>:ALEToggle<CR>
357 nnoremap <F4> <Esc>:ALEToggle<CR>
358 let g:ale_linters = {
359 \ 'cpp': ['gcc', 'cppcheck', 'clang'],
361 let b:ale_warn_about_trailing_whitespace = 1
362 let g:ale_sign_column_always = 1
363 let g:ale_cpp_clang_options =
364 \ '-std=c++14 -Wall -pedantic -fPIC
365 \ -I/usr/include/x86_64-linux-gnu/qt5
366 \ -I/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport
367 \ -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets
368 \ -I/usr/include/x86_64-linux-gnu/qt5/QtGui
369 \ -I/usr/include/x86_64-linux-gnu/qt5/QtCore
370 \ -I/usr/include/libdrm
371 \ -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g+
374 let g:ale_cpp_gcc_options =
375 \ '-std=c++14 -Wall -pedantic -fPIC
376 \ -I/usr/include/x86_64-linux-gnu/qt5
377 \ -I/usr/include/x86_64-linux-gnu/qt5/QtPrintSupport
378 \ -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets
379 \ -I/usr/include/x86_64-linux-gnu/qt5/QtGui
380 \ -I/usr/include/x86_64-linux-gnu/qt5/QtCore
381 \ -I/usr/include/libdrm
382 \ -I/usr/lib/x86_64-linux-gnu/qt5/mkspecs/linux-g+
387 if has("patch-7.4.354")
388 " Indents word-wrapped lines as much as the 'parent' line
390 " Ensures word-wrap does not split words
395 hi CursorLineNr term=underline cterm=underline ctermfg=White ctermbg=darkBlue guibg=darkyellow
397 "hi CursorLine gui=underline term=underline cterm=underline
400 au VimEnter,WinEnter,BufWinEnter * setlocal cursorline
401 au WinLeave * setlocal nocursorline
406 let g:acp_enableAtStartup = 1
407 let g:acp_behaviorPerlOmniLength = 0
408 let g:acp_behaviorPhpOmniLength = 0
409 let g:acp_completeoptPreview = 1
410 let g:acp_behaviorPythonOmniLength = 0
411 let g:acp_behaviorXmlOmniLength = 0
412 let g:acp_behaviorHtmlOmniLength = 0
413 let g:acp_behaviorCssOmniPropertyLength = 1
414 let g:acp_behaviorCssOmniValueLength = 0
416 " auskommentiert, macht in screen das nix gut aussieht..
420 let g:gruvbox_contrast_dark = 'dark'
421 let g:gruvbox_italicize_comments = 0
423 catch /^Vim\%((\a\+)\)\=:E185/
424 " wird evtl rest instlliert... E185 heißt nicht gefunden..
428 let &colorcolumn="121"
429 highlight ColorColumn ctermbg=lightgray guibg=lightcyan
431 highlight ExtraWhitespace ctermfg=red guifg=red ctermbg=white guibg=DarkGrey
433 " keine trailing whitespaces in hub log files anzeigen
434 match ExtraWhitespace /\s\+$/
436 let g:ale_python_flake8_options = "--max-line-length=120"
439 function! CopyFormatted(line1, line2)
440 let prev_number = &number
441 let prev_relativenumber = &relativenumber
442 let prev_background = &background
445 setlocal relativenumber!
446 setlocal background=light
447 " wenn ft manuel gesetzt war wird das von set background zurueckgesetzt, deswegen gleich wieder setzen
448 exe 'setlocal ft='.expand(prev_ft)
450 execute a:line1 . "," . a:line2 . "TOhtml"
452 !start /min powershell -noprofile "gcb | scb -as"
458 if (prev_relativenumber)
461 exe 'setlocal background='.expand(prev_background)
462 exe 'setlocal ft='.expand(prev_ft)
465 command! -range=% HtmlClip silent call CopyFormatted(<line1>,<line2>)