Vimrc config with GNU formatting

Bernhard Reutner-Fischer rep.dot.nop@gmail.com
Thu Sep 4 20:23:00 GMT 2014


On Thu, Sep 04, 2014 at 03:22:15PM +0200, Richard Biener wrote:
> On Thu, Sep 4, 2014 at 3:06 PM, Yury Gribov <y.gribov@samsung.com> wrote:
> > Hi all,
> >
> > This patch adds a Vim config (.local.vimrc) to root folder. This would allow
> > automatic setup of GNU formatting for C/C++/Java/Lex files in GCC (similar
> > to what we already have for Emacs via .dir-locals.el). The formatting is
> > borrowed from https://gcc.gnu.org/wiki/FormattingCodeForGCC
> >
> > Ok to commit?
> 
> For some reason I use
> 
> set shiftwidth=4
> set tabstop=8
> set autoindent
> set cinoptions={.5s,g0,p5,t0,(0,^-0.5s,n-0.5s
> 
> I note some differences to your
> 
> +  setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1
> ...
> +  setlocal shiftwidth=2
> 
> Not that I can parse any of the above without looking up vim docs ;)

Yuri,
Not sure from whom i borrowed this, perhaps even from you richi, but the
gcc_style.vim pasted in the mail below seems to be floating around ;)

https://gcc.gnu.org/ml/gcc-patches/2012-12/msg01228.html

This automatically applies the "gcc style" if the first 25 lines of the
file being opened contains the syndicated "This file is part of GCC" so
should transparently not set GNU style on foreign stuff like sanitizer.

HTH..
cheers,



More information about the Gcc-patches mailing list