Here is the _vimrc I use on a 5.x version of vim. I agree that
it is best to just not put tabs into the code, and just use
spaces.
Note that the
compile error stuff does not work any more. I am not sure if it
was a new ant version or a new jvm version that broke it. If anyone
has a good setting for the following 2 I would appreciate it:
makeprg
errorformat
Bryan Pendleton wrote:
I'm having trouble getting my editor set up properly
to work with the Derby source code.
Can somebody send me the commonly-accepted Derby source
code tab-and-spacing conventions?
I'm using VIM, so ideally if somebody could point me at
a .vimrc that set things up "the right way"...
thanks,
bryan
P.S. Here's what I currently use; it intentionally avoids
putting hard tabs into the code because I've found they
don't work as well as spaces.
:filetype indent on
:set softtabstop=4
:set shiftwidth=4
:set expandtab
:set ic
" An example for a vimrc file.
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
version 4.0 " avoid warning for wrong version
set bs=2 " allow backspacing over everything in insert mode
set ai " always set autoindenting on
"set backup " keep a backup file
set tabstop=4
set shiftwidth=4
set showmatch
set noerrorbells
set visualbell
set aw
set smartindent
set expandtab
"set makeprg=dbuild.ksh\ \\\|\ grep\ \'(.*\)\:\'
"set makeprg=ant\ -emacs\ -Dbuild.compiler.emacs=on\ 2>1\\\|\ grep\ \'(.*\)\:\'
"set makeprg=ant\ -emacs\ -Dbuild.compiler.emacs=on\ 2>/dev/null\\\|\ grep\
\'java:'
set makeprg=ant\ -emacs\ -Dbuild.compiler.emacs=on\ 2>/dev/null\\\|\ grep\
\'Error'
"set errorformat=C:%f:%l:%c:.*Error:%m
"set errorformat=C:%f:%l:%c:%**[0-9]:%**[0-9]: Error:%m
"set errorformat=C:%f:%l:%c:%**[0-9]:%**[0-9]: Error:%m
set errorformat=C:%f:%l:%c:%*\\d:%*\\d:%*\\s%m
" When starting to edit a file:
" For *.c and *.h files set formatting of comments and set C-indenting on
" For other files switch it off
" Don't change the sequence, it's important that the line with * comes first.
autocmd BufRead,BufNewFile * set formatoptions=tcql nocindent comments&
autocmd BufRead,BufNewFile *.java,*.c,*.h set formatoptions=croql cindent
comments=sr:/*,mb:*,el:*/,://
"autocmd BufRead,BufNewFile *.java,*.c,*.h set formatoptions=croql cindent
comments=sr:/**,mlb:*,el:**/,://,sr:/*,mb:*,el:*/
" Enable editing of gzipped files
" read: set binary mode before reading the file
" uncompress text in buffer after reading
" write: compress file after writing
" append: uncompress file, append, compress file
autocmd BufReadPre,FileReadPre *.gz set bin
autocmd BufReadPost,FileReadPost *.gz '[,']!gunzip
autocmd BufReadPost,FileReadPost *.gz set nobin
autocmd BufWritePost,FileWritePost *.gz !mv <afile> <afile>:r
autocmd BufWritePost,FileWritePost *.gz !gzip <afile>:r
autocmd FileAppendPre *.gz !gunzip <afile>
autocmd FileAppendPre *.gz !mv <afile>:r <afile>
autocmd FileAppendPost *.gz !mv <afile> <afile>:r
autocmd FileAppendPost *.gz !gzip <afile>:r
" Only do this for Vim version 5.0 and later.
if version >= 500
" Enable syntax highlighting
" set background=dark
" syntax on
let java_ignore_javadoc=1
" Set the location of my syntax overrides and read the defaults
"let mysyntaxfile = $VIM . "/usersyntax/usersyntax.vim"
"source $VIM/syntax/syntax.vim
endif