Date: Mon, 16 Jul 2007 09:26:50 -0500 (CDT) From: "Sean C. Farley" <scf@FreeBSD.org> To: Tom Evans <tevans.uk@googlemail.com> Cc: freebsd-hackers@FreeBSD.org Subject: Re: Setting up development environment Message-ID: <20070716090646.V27236@thor.farley.org> In-Reply-To: <1184586173.2017.5.camel@localhost> References: <43801.64.117.137.69.1180473436.squirrel@webmail.ifxnw.cl> <86abvm3k89.fsf@dwp.des.no> <1184586173.2017.5.camel@localhost>
next in thread | previous in thread | raw e-mail | index | archive | help
This message is in MIME format. The first part should be readable text,
while the remaining parts are likely unreadable without MIME-aware tools.
--0-1498711889-1184596010=:27236
Content-Type: TEXT/PLAIN; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: QUOTED-PRINTABLE
On Mon, 16 Jul 2007, Tom Evans wrote:
> On Wed, 2007-05-30 at 08:21 +0200, Dag-Erling Sm=F8rgrav 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()
=09let indent =3D cindent(v:lnum)
=09if indent > 4000
=09=09if cindent(v:lnum - 1) > 4000
=09=09=09return indent(v:lnum - 1)
=09=09else
=09=09=09return indent(v:lnum - 1) + 4
=09=09endif
=09else
=09=09return (indent)
=09endif
endfun
" Conform to style(9).
fun! FreeBSD_Style()
=09setlocal cindent
=09setlocal formatoptions=3Dclnoqrt
=09setlocal textwidth=3D80
=09setlocal indentexpr=3DIgnoreParenIndent()
=09setlocal indentkeys=3D0{,0},0),:,0#,!^F,o,O,e
=09setlocal cinoptions=3D(4200,u4200,+0.5s,*500,t0,U4200
=09setlocal shiftwidth=3D8
=09setlocal tabstop=3D8
=09setlocal noexpandtab
endfun
---------------------------------------------
Sean
--=20
scf@FreeBSD.org
--0-1498711889-1184596010=:27236--
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070716090646.V27236>
