On Mon, 16 Jul 2007, Tom Evans wrote:
On Wed, 2007-05-30 at 08:21 +0200, Dag-Erling Smørgrav wrote:
...
Emacs setup (for both C and C++):
(defun des-knf ()
(interactive)
;; Basic indent is 8 spaces
(make-local-variable 'c-basic-offset)
(setq c-basic-offset 8)
;; Continuation lines are indented 4 spaces
(make-local-variable 'c-offsets-alist)
(c-set-offset 'arglist-cont 4)
(c-set-offset 'arglist-cont-nonempty 4)
(c-set-offset 'statement-cont 4)
;; Labels are flush to the left
(c-set-offset 'label [0])
;; Fill column
(make-local-variable 'fill-column)
(setq fill-column 74))
(add-hook 'c-mode-common-hook 'des-knf)
As for how to cross-build, read build(7).
DES
Before I start translating this/style(9), does anyone already have an
equivalent for vim?
I have not made a proper indent file out of this, but this is what I
use. Before I work on BSD code I just run :call FreeBSD_Style(). The
IgnoreParenIndent() function is needed to avoid vim's built-in cindent
code when it comes to line-continuation after a parentheses. Better
solutions are welcome.
---------------------------------------------
set nocompatible
set autoindent
" Let vim determine the file type to be edited.
"filetype plugin indent on
" Ignore indents caused by parentheses in FreeBSD style.
fun! IgnoreParenIndent()
let indent = cindent(v:lnum)
if indent > 4000
if cindent(v:lnum - 1) > 4000
return indent(v:lnum - 1)
else
return indent(v:lnum - 1) + 4
endif
else
return (indent)
endif
endfun
" Conform to style(9).
fun! FreeBSD_Style()
setlocal cindent
setlocal formatoptions=clnoqrt
setlocal textwidth=80
setlocal indentexpr=IgnoreParenIndent()
setlocal indentkeys=0{,0},0),:,0#,!^F,o,O,e
setlocal cinoptions=(4200,u4200,+0.5s,*500,t0,U4200
setlocal shiftwidth=8
setlocal tabstop=8
setlocal noexpandtab
endfun
---------------------------------------------
Sean
--
[EMAIL PROTECTED]
_______________________________________________
freebsd-hackers@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-hackers
To unsubscribe, send any mail to "[EMAIL PROTECTED]"