Re: Setting up development environment

看板FB_hackers作者時間18年前 (2007/07/24 11:05), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串7/7 (看更多)
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 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org" --0-1498711889-1184596010=:27236--
文章代碼(AID): #16fMnw00 (FB_hackers)
討論串 (同標題文章)
文章代碼(AID): #16fMnw00 (FB_hackers)