The following .vimrc produces, in our opinion, very nicely formatted C code:
set nocp incsearch
set cinoptions=:0,p0,t0
set cinwords=if,else,while,do,for,switch,case
set formatoptions=tcqr
set cindent
syntax on
source ~/.exrc
The nocp option turns off strict vi compatibility. The incsearch option turns on
incremental searching. The settings for cinoptions, cinwords, and
formatoptions differ from the defaults; the result is to produce a fairly strict
"K&R" C formatting style. Finally, syntax coloring is turned on, and then the rest
of the vi options are read in from the user's .exrc file.
沒有留言:
張貼留言