" vim configuration of Sebastian Reichel set nocompatible " vim native mode syntax on " enable syntax highlighting let c_comment_strings=1 colorscheme elektranox " cool colors set clipboard=unnamedplus " use X11 clipboard for copy/paste set hlsearch " highlight searched word set number " numberize lines set ruler " lower file set nowrap " do not wrap lines set incsearch " search while typing set foldmethod=syntax " automatic code-folding set autoindent " automatic indention set noerrorbells visualbell t_vb= " no audible bell set mouse=a " set mouse to auto set ruler " show cursor position all the time set wildmode=longest,list " setup wildmode set showmatch " show matching brackets set encoding=utf-8 " UTF-8 "set iskeyword-=_ " _ is a word delimiter set autoread set noexpandtab set t_Co=256 set tabpagemax=32 autocmd Filetype gitcommit set textwidth=72 autocmd Filetype gitcommit set spell " spellcheck setup (disabled by default) set spellfile=~/.vim/spell/en.add,~/.vim/spell/de.add,~/.vim/spell/names.add set spelllang=en,de let g:netrw_dirhistmax=0 " disable anoying ~/.vim/.netrwhist " Configure the status line show something useful. "set statusline=%F%m%r%h%w\ %y\ [%{&ff}]%=[%l,%v][%p%%]\ [%L] "set laststatus=2 " Ensure status line is visible. " Sane handling of whitespace. set tabstop=4 set shiftwidth=4 set softtabstop=4 " The h and l keystrokes can be made to wrap over lines (so that trying to " move left past the beginning of a line puts the cursor at the end of the " line above). This command does that, and also allows ~ (convert case) to " wrap over lines, and the cursor keys to wrap when in insert mode: set whichwrap=h,l,~,[,] " Get useful auto-completion in command mode. set wildmenu set wildmode=list:longest,full " save as root with w!! cmap w!! w !/usr/bin/sudo /usr/bin/tee > /dev/null % " copy&paste via nnoremap \tp :set invpaste paste? nmap \tp imap \tp set pastetoggle= " clear search via nnoremap \clearsearch :let @/ = "" nmap \clearsearch imap \clearsearch " compile latex/code via nnoremap \make :!make nmap \make imap \make " insert newline without editing mode map o nmap :ConqueTerm zsh nmap :TagbarToggle " add vala support autocmd BufRead *.vala set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m autocmd BufRead *.vapi set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m autocmd BufRead *.gtkaml set efm=%f:%l.%c-%[%^:]%#:\ %t%[%^:]%#:\ %m au BufRead,BufNewFile *.vala setfiletype vala au BufRead,BufNewFile *.vapi setfiletype vala au BufRead,BufNewFile *.gtkaml setfiletype vala let vala_comment_strings = 1 let vala_space_errors = 1 " highlight space errors in vala code " G-Code au BufRead,BufNewFile *.nc setfiletype nc " add support for subtitle files au BufNewFile,BufRead *.ssa setf ssa au BufNewFile,BufRead *.ass setf ssa au BufNewFile,BufRead *.proto setf proto " configure printing stuff set pdev=Default " printer device set printoptions=paper:A4,syntax:n,wrap:y,duplex:long " print options set penc=utf-8 " print encoding "set pfn=courier:h10 " print font "set pheader=... " print header " set terminal title if &term == "screen" set t_ts=k set t_fs=\ endif if &term == "screen" || &term == "xterm" set title endif " Set a nicer foldtext function set foldtext=MyFoldText() function! MyFoldText() let line = getline(v:foldstart) if match( line, '^[ \t]*\(\/\*\|\/\/\)[*/\\]*[ \t]*$' ) == 0 let initial = substitute( line, '^\([ \t]\)*\(\/\*\|\/\/\)\(.*\)', '\1\2', '' ) let linenum = v:foldstart + 1 while linenum < v:foldend let line = getline( linenum ) let comment_content = substitute( line, '^\([ \t\/\*]*\)\(.*\)$', '\2', 'g' ) if comment_content != '' break endif let linenum = linenum + 1 endwhile let sub = initial . ' ' . comment_content else let sub = line let startbrace = substitute( line, '^.*{[ \t]*$', '{', 'g') if startbrace == '{' let line = getline(v:foldend) let endbrace = substitute( line, '^[ \t]*}\(.*\)$', '}', 'g') if endbrace == '}' let sub = sub.substitute( line, '^[ \t]*}\(.*\)$', '...}\1', 'g') endif endif endif let n = v:foldend - v:foldstart + 1 let info = " " . n . " lines" let sub = sub . " " let num_w = getwinvar( 0, '&number' ) * getwinvar( 0, '&numberwidth' ) let fold_w = getwinvar( 0, '&foldcolumn' ) let sub = strpart( sub, 0, winwidth(0) - strlen( info ) - num_w - fold_w - 1 ) return sub . info endfunction " open epub files as zip au BufReadCmd *.epub call zip#Browse(expand("")) " enable plugins depending on filetype filetype plugin on " git branch in ruler if has('nvim') " no fugitive in nvim for now else set rulerformat=%33(%{fugitive#statusline()}%=%10(%l,%c%V%=%5(%p%%%)%)%) endif " tex = latex let g:tex_flavor='latex' " debian/control indents must be spaces autocmd FileType debcontrol set expandtab autocmd BufNewFile,BufRead /home/sre/src/u-boot/* set tabstop=8 shiftwidth=8 softtabstop=8 autocmd BufNewFile,BufRead /home/sre/src/linux/* set tabstop=8 shiftwidth=8 softtabstop=8 autocmd BufNewFile,BufRead /home/sre/src/linux-*/* set tabstop=8 shiftwidth=8 softtabstop=8 if has('nvim') " no pathogen in nvim for now else execute pathogen#infect() endif inoremap :call align()a " automatic alignment of ascii-art tables function! s:align() let p = '^\s*|\s.*\s|\s*$' if exists(':Tabularize') && getline('.') =~# '^\s*|' && (getline(line('.')-1) =~# p || getline(line('.')+1) =~# p) let column = strlen(substitute(getline('.')[0:col('.')],'[^|]','','g')) let position = strlen(matchstr(getline('.')[0:col('.')],'.*|\s*\zs.*')) Tabularize/|/l1 normal! 0 call search(repeat('[^|]*|',column).'\s\{-\}'.repeat('.',position),'ce',line('.')) endif endfunction " Rename tabs to show tab number " https://superuser.com/questions/331272/vim-show-the-index-of-tabs-in-the-tabline if exists("+showtabline") function! MyTabLine() let s = '' let wn = '' let t = tabpagenr() let i = 1 while i <= tabpagenr('$') let buflist = tabpagebuflist(i) let winnr = tabpagewinnr(i) let s .= '%' . i . 'T' let s .= (i == t ? '%1*' : '%2*') let s .= ' ' let wn = tabpagewinnr(i,'$') let s .= '%#TabNum#' let s .= i " let s .= '%*' let s .= (i == t ? '%#TabLineSel#' : '%#TabLine#') let bufnr = buflist[winnr - 1] let file = bufname(bufnr) let buftype = getbufvar(bufnr, 'buftype') if buftype == 'nofile' if file =~ '\/.' let file = substitute(file, '.*\/\ze.', '', '') endif else let file = fnamemodify(file, ':p:t') endif if file == '' let file = '[No Name]' endif let s .= ' ' . file . ' ' let i = i + 1 endwhile let s .= '%T%#TabLineFill#%=' let s .= (tabpagenr('$') > 1 ? '%999XX' : 'X') return s endfunction set stal=2 set tabline=%!MyTabLine() set showtabline=1 highlight link TabNum Special endif let g:syntastic_mode_map = { 'mode': 'passive', 'active_filetypes': [],'passive_filetypes': [] } noremap e :SyntasticCheck noremap f :SyntasticToggleMode