" The .vimrc file complies with current rosetta++ coding guidelines
" by Bin Qian bqian@u.washington.edu

" have syntax highlighting in terminals which can display colours:
if has('syntax') && (&t_Co > 2)
  syntax on
endif

" highlight the trailing white spaces
au Syntax *    syn match Error /\s\+$/ | syn match Error /^\s* \t\s*/

" remove the trailing white space when save
autocmd BufWritePre * silent! %s/[\r \t]\+$//

" have fifty lines of command-line history:
set history=50
set viminfo=/10,'10,r/mnt/zip,r/mnt/floppy,f0,h,\"100

" display the current mode and partially-typed commands in the status line:
set showmode
set showcmd

" when using list, keep tabs at their full width and display `arrows':

" don't have files trying to override this .vimrc:
set nomodeline

" * Text Formatting -- General

" use indents of 2 spaces, and have them copied down lines:
set shiftwidth=2
set shiftround
set expandtab
set autoindent

" automatically reformat the comment lines with text width of 79
set formatoptions-=t
set textwidth=79


" * Text Formatting for Specific File Formats

" enable filetype detection:
filetype on

" for C-like programming, have automatic indentation and tab space of 2:
autocmd FileType c,cpp,slang,cc set ts=2 noet

" for actual C (not C++) programming where comments have explicit end
" characters, if starting a new line in the middle of a comment automatically
" insert the comment leader characters:
autocmd FileType c set formatoptions+=ro ts=2 noet

" for Perl programming, have things in braces indenting themselves:
autocmd FileType perl set smartindent

" in makefiles, don't expand tabs to spaces, since actual tab characters are
" needed, and have indentation at 8 chars to be sure that all indents are tabs
autocmd FileType make set noexpandtab shiftwidth=8


" make searches case-insensitive, unless they contain upper-case letters:
" set ignorecase
" set smartcase

" show the `best match so far' as search strings are typed:
set incsearch
