" Flori's vimrc " General Settings "set autochdir "set wildmode=list:full "set swapsync= set autoindent set autowrite set backspace=indent,eol,start set dictionary=/usr/dict/words set digraph set encoding=utf8 set errorformat+=%f:%l set expandtab shiftwidth=2 tabstop=2 set foldcolumn=0 set formatoptions=cqrt set fsync set grepformat+=%f set grepformat+=%f:%l set hidden set history=1000 set hlsearch set laststatus=2 set makeprg=errf set modelines=5 set mouse=nv set mousehide set nocindent set nocompatible set nocursorcolumn set nocursorline set nofoldenable set noignorecase set noincsearch set nojoinspaces set nopaste set nosmartcase set nosmartindent set nowrap set nonumber set ruler set shortmess=atI set showcmd set showmatch set showmode set smarttab set statusline=%<%f%m%r%=%(%Bh=%bd%)@%(%l:%c\%)%4P set swapsync="fsync" set termencoding=utf8 set title set ttyfast set viminfo='20,<50,s10,h,! set visualbell t_vb= set wildchar= set wildmenu set winminheight=0 filetype on filetype indent on filetype plugin on source $VIMRUNTIME/macros/matchit.vim " Configure GUIs if has("gui_running") set guipty colorscheme flori hi Pmenu ctermbg=Grey guibg=DarkGrey set guioptions-=r if exists("+guioptions") set guioptions+=c end if has("gui_win32") set guifont=DejaVu\ Sans\ Mono:h12 "set antialias if exists("+guioptions") set guioptions-=T set guioptions-=m set guioptions+=p endif elseif has("gui_gtk2") set guifont=DejaVu\ Sans\ Mono\ 12 if exists("+guioptions") set guioptions-=T set guioptions-=m set guioptions+=p endif set guiheadroom=0 set columns=80 set lines=59 elseif has("gui_mac") || has("gui_macvim") set guifont=DejaVu\ Sans\ Mono:h14 if exists("+guioptions") set guioptions-=T set guioptions-=m set guioptions+=p endif set antialias set guiheadroom=0 "set macatsui set columns=80 set lines=71 elseif has("x11") set guifont=-b&h-lucidatypewriter-*-*-normal-*-17-*-*-*-*-*-iso10646-* if exists("+guioptions") set guioptions-=T set guioptions-=m endif end else set background=dark hi DiffAdd ctermbg=green hi DiffChange ctermbg=blue hi DiffText ctermbg=gray hi DiffDelete ctermbg=red end " Syntax let ruby_operators=1 if has("syntax") syntax on endif " Browsing if has("browse") let g:explVertical=0 " let g:explSplitRight=1 let g:explSplitBelow=0 " let g:explStartRight=0 let g:explStartBelow=1 let g:explDetailedList=1 let g:explDateFormat="%Y-%m-%d %H:%M:%S" " let g:explHideFiles='^\.,\.gz$,\.exe$,\.zip$' let g:explUseSeparators=1 " Use separator lines endif let g:netrw_longlist=1 let g:netrw_use_noswf= 0 let g:netrw_hide=1 let g:netrw_list_hidee='\..*\.sw[pon]$' let g:rails_statusline=0 let g:LustyJugglerSuppressRubyWarning=1 " CScope if has("cscope") " set csprg=/usr/local/bin/cscope set cscopetagorder=0 set cscopetag set nocsverb " add any database in current directory if filereadable("cscope.out") cs add cscope.out " else add database pointed to by environment elseif $CSCOPE_DB != "" cs add $CSCOPE_DB endif set csverb endif " Mappings let mapleader="," let maplocalleader="," " open another file in this files directory map e :e =substitute(expand("%:p:h") . "/", " ", "\\\\ ", "g") map t :tabe =substitute(expand("%:p:h") . "/", " ", "\\\\ ", "g") map s :split =substitute(expand("%:p:h") . "/", " ", "\\\\ ", "g") map c :cd =substitute(expand("%:p:h") . "/", " ", "\\\\ ", "g") " Switch of search highlighting map :nohlsearch if has("fullscreen") set fuoptions=maxhorz,maxvert function! Cfullscreen() if &fullscreen == "1" set nofullscreen else set fullscreen endif endfunction map :call Cfullscreen() endif function! Ctoggle() if &buftype == "quickfix" cclose else copen endif endfunction nnoremap :call Ctoggle() " Switch Windows map j_ map k_ " Switch Buffers map :bn map :bp " Configure navigation keys " noremap " noremap " noremap " noremap " noremap " noremap " noremap " noremap " noremap " noremap cnoremap cnoremap cnoremap cnoremap b cnoremap f vnoremap < >gv " Marks nnoremap ' ` nnoremap ` ' if has("autocmd") " Auto Command - Hooks augroup gzip autocmd! autocmd BufReadPre,FileReadPre *.gz setl bin autocmd BufReadPost,FileReadPost *.gz '[,']!gzip -d autocmd BufReadPost,FileReadPost *.gz setl nobin autocmd BufReadPost,FileReadPost *.gz execute ":doautocmd BufReadPost " . expand("%:r") autocmd BufWritePost,FileWritePost *.gz !mv :r autocmd BufWritePost,FileWritePost *.gz !gzip :r autocmd FileAppendPre *.gz !gzip -d autocmd FileAppendPre *.gz !mv :r autocmd FileAppendPost *.gz !mv :r autocmd FileAppendPost *.gz !gzip :r augroup END augroup bzip2 autocmd! autocmd BufReadPre,FileReadPre *.bz2 setl bin autocmd BufReadPost,FileReadPost *.bz2 '[,']!bzip2 -d autocmd BufReadPost,FileReadPost *.bz2 setl nobin autocmd BufReadPost,FileReadPost *.bz2 execute ":doautocmd BufReadPost " . expand("%:r") autocmd BufWritePost,FileWritePost *.bz2 !mv :r autocmd BufWritePost,FileWritePost *.bz2 !bzip2 :r autocmd FileAppendPre *.bz2 !bz2ip -d autocmd FileAppendPre *.bz2 !mv :r autocmd FileAppendPost *.bz2 !mv :r autocmd FileAppendPost *.bz2 !bzip2 -d :r augroup END augroup tex autocmd! autocmd FileType tex map :!latex % autocmd FileType tex map :!dvips `echo %\|sed -e 's/tex/dvi/'` autocmd FileType tex map :!xdvi -s 0 `echo %\|sed -e 's/tex/dvi/'` & autocmd FileType tex map :!gv `echo %\|sed -e 's/tex/ps/'` & autocmd FileType tex map :!pdflatex % autocmd FileType tex map :!acroread `echo %\|sed -e 's/tex/pdf/'` augroup END augroup c autocmd! autocmd FileType c setl sw=4 ts=4 cinoptions= formatoptions=cqrol cindent autocmd FileType c map :make autocmd FileType c map :%!indent 2>/dev/null -kr -i 4 autocmd FileType c map :make clean autocmd FileType c map i/* a */ augroup END augroup pascal autocmd! autocmd FileType pascal setl et st=2 sw=2 autoindent autocmd FileType pascal map :!gpc -o `echo %\|sed -e 's/\.pas//'` % autocmd FileType pascal map i{ a } augroup END augroup perl autocmd! autocmd Filetype perl setl et sw=4 ts=4 autoindent autocmd FileType perl map :w:!perl -c % autocmd FileType perl map :w:!perl -Tc % autocmd FileType perl map :w:.!perl -lne '/^(sub\s+\S+\s*\([^)]*\))\s*\{/ and print "$1;"' % autocmd FileType perl map :w:%!perl -pe 's/(sub \w+ *)\(.*\) */$1/' autocmd FileType perl map i# autocmd FileType perl map :w:!perl -I lib -I cfg % augroup END augroup ruby autocmd! autocmd FileType ruby setl et sw=2 ts=2 autoindent keywordprg=ri\ --no-pager autocmd FileType ruby map :w:!RUBYOPT="$RUBYOPT -Iext:lib:test:tests" ruby -wc % autocmd FileType ruby map :w:!RUBYOPT="$RUBYOPT -Iext:lib:test:tests" ruby % \| ruby -S decolor autocmd FileType ruby map :w:!rcov -Iext:lib:test:tests % autocmd FileType ruby map i# autocmd FileType ruby map !xmp ruby autocmd FileType ruby nmap V autocmd FileType ruby imap a autocmd FileType ruby map :w:%!xmp ruby -Iext:lib -w autocmd FileType ruby map :w:%!RUBYOPT="" xmp /usr/local/ruby-1.9/bin/ruby -Iext:lib -w autocmd FileType ruby map :!exuberant-ctags 2>/dev/null -R . autocmd FileType ruby setl suffixesadd=.rb,.h,.c autocmd FileType ruby setl path+=lib/** autocmd FileType ruby setl path+=test/** autocmd FileType ruby setl path+=tests/** autocmd FileType ruby imap l* augroup END augroup javascript autocmd! autocmd BufNewFile,BufRead *.json setl filetype=javascript autocmd FileType javascript setl et sw=2 ts=2 cindent augroup end augroup java autocmd! autocmd FileType java setl cindent et sw=4 ts=4 autocmd FileType java map :w:!javac -deprecation % autocmd FileType java map :w:!javac % autocmd FileType java map :!rm `echo %\|sed -e 's/java/class/'` autocmd FileType java map i// autocmd FileType java map :w:!astyle -j %:n % autocmd FileType java nnoremap :JavaBrowser autocmd FileType java let JavaBrowser_Ctags_Cmd = '/usr/bin/exuberant-ctags' autocmd FileType java let JavaBrowser_Sort_Type = "name" autocmd FileType java let JavaBrowser_Display_Prototype = 1 autocmd FileType java let JavaBrowser_Use_SingleClick = 0 augroup END augroup lisp autocmd! autocmd FileType lisp setl lisp autoindent augroup END augroup scheme autocmd! autocmd FileType scheme setl lisp autoindent augroup END augroup ocaml autocmd! autocmd FileType ocaml setl et sw=2 ts=2 autoindent augroup END augroup xml autocmd! autocmd BufNewFile,BufRead *.jsf,*.jsp,*.babel,*.konfetti,*.tag,*.tld setl filetype=xml autocmd FileType xml setl et sw=2 ts=2 autoindent autocmd FileType xml map :w:!tidy -xml -raw -e % autocmd FileType xml map :%!tidy -xml -raw -i 2>/dev/null augroup END augroup html autocmd! autocmd FileType xml setl et sw=2 ts=2 autoindent autocmd FileType html map :w:!tidy -e % autocmd FileType html map :%!tidy -wrap 72 -iu 2>/dev/null augroup END augroup html2 autocmd! autocmd BufReadPre,FileReadPre *.html.* map :w:!tidy -e % autocmd BufReadPre,FileReadPre *.html.* map :%!tidy -wrap 72 -iu 2>/dev/null autocmd BufReadPre,FileReadPre *.html.* so $VIMRUNTIME/syntax/html.vim augroup END augroup misc autocmd! autocmd BufWritePost ~/.vimrc so ~/.vimrc augroup END augroup mutt autocmd! autocmd BufNewFile,BufRead mutt-* setl textwidth=72 augroup END endif function! Cfind(...) if a:0 == 0 let args = [ expand( '') ] else let args = copy(a:000) endif set grepprg=discover exec "silent gr -a 'a-zA-Z0-9' -c -i " . join(map(copy(args), 'shellescape(v:val)'), ' ') copen endfunction function! Cgrep(...) if a:0 == 0 let args = [ expand( '') ] else let args = copy(a:000) endif set grepprg=search exec "silent gr -c -i " . join(map(args, 'shellescape(v:val)'), ' ') copen endfunction function! Ctest(...) exec 'w' if a:0 == 0 let name = expand('') else let name = a:1 endif exec 'make ' . expand('%') . ' ' . name endfunction function! Cclassify(...) if a:0 == 0 let args = [ expand( '') ] else let args = copy(a:000) endif let output = system("classify -b " . join(map(copy(args), 'shellescape(v:val)'), ' ')) execute "normal a" . output endfunction function! CpathClassify(...) if a:0 == 0 let args = [ expand( '') ] else let args = copy(a:000) endif let output = system("classify " . join(map(copy(args), 'shellescape(v:val)'), ' ')) execute "normal a" . output endfunction function! Cdeclassify(...) if a:0 == 0 let args = [ expand( '') ] else let args = copy(a:000) endif let output = system("classify -d " . join(map(copy(args), 'shellescape(v:val)'), ' ')) execute "normal a" . output endfunction comclear command -bar -nargs=1 OpenURL :!open command -bar -nargs=* -complete=file Find :call Cfind() command -bar -nargs=* -complete=file Grep :call Cgrep() command -bar -nargs=* -complete=file Test :call Ctest() command -bar -nargs=* -complete=file Classify :call Cclassify() command -bar -nargs=* -complete=file PathClassify :call CpathClassify() command -bar -nargs=* -complete=file Declassify :call Cdeclassify() function! Iexec(cmd) let output = system(a:cmd) execute "normal a" . output endfunction function! Itime(fmt) execute "normal a" . strftime(a:fmt) endfunction " Abbreviations iabclear iabbrev I_MFG Mit freundlichen GrĂ¼ssen,Florian Frank iabbrev I_DATE :call Itime("%F") iabbrev I_DATETIME :call Itime("%F %T") iabbrev I_TIME :call Itime("%T") iabbrev I_KLASS :call Iexec("classify -b " . expand('%')) iabbrev I_PATH_KLASS :call Iexec("classify " . expand('%'))