" vim:nospell: " .vimrc by Johannes Gilger filetype plugin on " plugins based on filetype syntax on filetype on if $TERM == "xterm" || $TERM == "rxvt" || $TERM == "xterm-256color" || $TERM == "rxvt-unicode" || &term =~ "builtin_gui" || $TERM == "dumb" set t_Co=256 colorscheme calmar256-dark else colorscheme desert endif "set encoding=iso-8859-15 " should not be necessary! set fileencoding= set encoding& " terminal charset: follows current locale set termencoding= set fileencodings= " charset auto-sensing: disabled set fileencoding& " auto-sensed charset of current buffer set omnifunc=ccomplete#Complete set completeopt=menu,menuone set grepprg=grep\ -nH\ $* set ignorecase " searching, ignore case of search set smartcase " be smart about it ;) set scrolloff=5 " scrolling if cursor close to the screen edge set incsearch " incremental search set makeprg=make " what to do with :make set ruler " Show the cursor position all the time set nu " linenumbers set nuw=3 " linenumber-width set bs=2 " Allow backspacing over everything in insert mode set ai " Always set auto-indenting on set history=50 " keep 50 lines of command history set viminfo=\'100,\"500,:100" " read/write a .viminfo file -- limit regs to 500 lines set nocompatible " don't behave like vi "set cindent " enable automatic indention "set smartindent " another type of indentation set showmatch " show matching parens/brackets set comments=sl:/*,mb:**,elx:*/ " enable automagic multi-line comments set formatoptions=tcoqw " automatic formating options set hlsearch " highligh last used search pattern set hidden " hidden buffers set wildmenu set tags=./tags,./TAGS,tags,TAGS,./../tags,./../TAGS,./../../tags,./../../TAGS set modeline set modelines=5 set foldenable " we do want folding set foldmethod=marker " standard: folding by {{{,}}} markers set swapsync= set listchars=tab:>-,trail:_ " how to show tabs, trailing spaces when list is on set statusline=%<%F%<%<%h%m%<%{GitBranchInfoString()}%r%=line=%03l,col=%02c%V,totlin=%L%\%=%-30(,BfNm=%n%Y%)\%P\* " cool statusline let g:git_branch_status_text=" " let g:git_branch_status_head_current=1 let g:git_branch_status_nogit="" set laststatus=2 " display the status line, not just in split-mode set guioptions-=r " dont display scrollbars when using the GUI "set cursorline " cursorline, high cpu load! autocmd BufNewFile,BufRead COMMIT_EDITMSG set filetype=gitcommit " for viewing git diffs autocmd QuickFixCmdPost * copen " open quickfix-window when using :make or :grep noremap Bs Del noremap Del Bs noremap!Bs Del noremap!Del Bs map :ls map ,m :make " :makeprg wird fuer jeden Filetype noch festgelegt nmap ,o ok " neue Zeile an der Stelle, oder darueber nmap ,O Oj nmap ,r i " Zeilenumbruch nmap ,h :nohlsearch nmap ,H :set hlsearch nmap ,a :diffget 1 nmap ,d :diffget 3 nmap ,p :set mouse=a nmap ,n :NERDTreeToggle map Q gq " Don't use Ex mode, use Q for formatting noremap :make " invoke make, see the output map :!make " invoke make in the background nmap :cn " show next error by pressing if has("autocmd") " needed for viminfo under mac os x autocmd BufReadPost * \ if line("'\"") > 0 && line("'\"") <= line("$") | \ exe "normal g`\"" | \ endif endif if has("spell") set spelllang=de " language for spell-checking map :set spell!:echo "Spell Check: " . strpart("OffOn", 3 * &spell, 3) " toggle spell-checking with F6 endif fu! FileTime() let ext=tolower(expand("%:e")) let fname=tolower(expand('%<')) let filename=fname . '.' . ext let msg="" let msg=msg." ".strftime("(Modified %b,%d %y %H:%M:%S)",getftime(filename)) return msg endf fu! CurTime() let ftime="" let ftime=ftime." ".strftime("%b,%d %y %H:%M:%S") return ftime endf let Tlist_Ctags_Cmd="/usr/bin/exuberant-ctags" " set program used for taglist-creation let &errorformat="%f:%l: %t%*[^:]:%m," . &errorformat " Intelligent tab completion "inoremap =InsertTabWrapper(1) "inoremap =InsertTabWrapper(-1) function! InsertTabWrapper(direction) let idx = col('.') - 1 let str = getline('.') if a:direction > 0 && idx >= 2 && str[idx - 1] == ' ' \&& str[idx - 2] =~? '[a-z]' if &softtabstop && idx % &softtabstop == 0 return "\\\" else return "\\" endif elseif idx == 0 || str[idx - 1] !~? '[a-z]' return "\" elseif a:direction > 0 return "\" else return "\" endif endfunction function InsertTabWrapper(direction) " automagically decide what to do with let col = col('.') -1 " in insert mode if !col return "\" " insert Tab at the beginning of the line elseif a:direction < 0 return "\" " insert Backward-Completion elseif getline('.')[col - 1] == '' return "\\" " replace with elseif getline('.')[col - 1] !~ '\k' return "\" " insert Tab if preceding character is not a keyword character else return "\" " insert Forward-Completion endfunction "if v:lang =~ "utf8$" || v:lang =~ "UTF-8$" " set fileencodings=utf-8,latin1 "endif " set readonly files to nomodifiable "function! Ox() " if &readonly " set nomodifiable " endif " endfuction "autocmd BufReadPre * call Ox() "endfunction " automagically close ( [ { and " "imap ( () "imap [ [] "imap { {} "imap " "" "imap < <> "imap ' '' "autocmd Filetype c "set cursorline "hi cursorline guibg=#333333 "hi CursorColumn guibg=#333333 "source ~/.vim/vimCU.vimrc