This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Vimrc config with GNU formatting
- From: Bernhard Reutner-Fischer <rep dot dot dot nop at gmail dot com>
- To: Richard Biener <richard dot guenther at gmail dot com>
- Cc: Yury Gribov <y dot gribov at samsung dot com>, GCC Patches <gcc-patches at gcc dot gnu dot org>, Laurynas Biveinis <laurynas dot biveinis at gmail dot com>, Jeff Law <law at redhat dot com>
- Date: Thu, 4 Sep 2014 22:22:54 +0200
- Subject: Re: Vimrc config with GNU formatting
- Authentication-results: sourceware.org; auth=none
- References: <540863C1 dot 4000909 at samsung dot com> <CAFiYyc3j-enc0mtotgeMLC=n2ShgBLrLQtNLdXNp35_+1dVmzQ at mail dot gmail dot com>
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,