" general options set nocompatible set background=dark set showcmd set showmatch set ignorecase set smartcase set incsearch set autowrite syntax on filetype plugin indent on " TODO: reconsider this, possible risk set modeline set wrapmargin=4 set linebreak set ruler set cryptmethod=blowfish set foldmethod=syntax set scrolloff=3 set wildmenu set hlsearch set conceallevel=2 set ttyfast set undofile set nojoinspaces set belloff=all set splitbelow set splitright " tabs handling set expandtab set shiftwidth=4 set tabstop=4 " mouse set mouse=a set ttymouse=sgr " the default includes autoselect, which syncs contents of visual selection " to clipboard; that is slow and I don't need it set clipboard= " statusline " " colors: " User1: window number " User2: modified flag " " path [Help][Preview][RO][ftype] \\// [window number][+] set statusline=%(%f\ %h%w%r%y\ %=\ %1*[%{winnr()}]%2*%m%*%) " divider between left and right-aligned bits set statusline+=%= " line,byte column[-virtual column] set statusline+=%(%l,%c%V\ %=\ %P%) " use standard places for the vim state files set dir=~/.cache/vim/swap// set backupdir=~/.cache/vim/bkp// set undodir=~/.local/var/vim/undo set viminfo+=n~/.local/var/vim/viminfo if &t_Co < 88 colorscheme default else let g:inkpot_black_background = 1 colorscheme inkpot endif " trailing whitespace highlighting augroup vimrc autocmd! autocmd VimEnter,WinNew * call matchadd('WhiteSpaceEOL', '\s\+$') augroup END " extension-based filetypes let filetype_m="mma" let filetype_par="config" ".tex files default to latex let g:tex_flavor='latex' " enable syntax folding in viml files let g:vimsyn_folding = 'af' " autodisable syntax folding for c files (it's slow) autocmd BufEnter *.c,*.h setlocal foldmethod=manual " C indent options set cinoptions=(0 """ key mappings map zJ zjzo " the default mapping enters the ex mode, which is very annoying since it's " easy to trigger by mistake (going for ZQ, missing Z) map Q nmap gb :bnext nmap gB :bprevious map m :make " zoom/maximize a window nnoremap z \|_ " miniSnip configuration " FIXME split off? let g:miniSnip_trigger = '' " line diff mode " TODO: split off into plugin? function LineDiff() silent execute "!linediff " . v:fname_in . " " . v:fname_new . " > " . v:fname_out endfunction function SetLineDiff() set diffexpr=LineDiff() diffupdate redraw endfunction " hybrid line numbers augroup numbertoggle autocmd! autocmd BufEnter,FocusGained,InsertLeave,WinEnter * if &nu | set rnu | endif autocmd BufLeave,FocusLost,InsertEnter,WinLeave * if &nu | set nornu | endif augroup END