From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9237 invoked by alias); 13 Oct 2014 10:27:40 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 9227 invoked by uid 89); 13 Oct 2014 10:27:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mailout1.w1.samsung.com Received: from mailout1.w1.samsung.com (HELO mailout1.w1.samsung.com) (210.118.77.11) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (DES-CBC3-SHA encrypted) ESMTPS; Mon, 13 Oct 2014 10:27:37 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout1.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NDD0073HP6SN890@mailout1.w1.samsung.com> for gcc-patches@gcc.gnu.org; Mon, 13 Oct 2014 11:30:28 +0100 (BST) Received: from eusync4.samsung.com ( [203.254.199.214]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id A6.57.15956.519AB345; Mon, 13 Oct 2014 11:27:33 +0100 (BST) Received: from [106.109.9.145] by eusync4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NDD006H5P0X4SB0@eusync4.samsung.com>; Mon, 13 Oct 2014 11:27:33 +0100 (BST) Message-id: <543BA8F1.6020305@samsung.com> Date: Mon, 13 Oct 2014 10:33:00 -0000 From: Yury Gribov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.2 MIME-version: 1.0 To: GCC Patches Cc: Laurynas Biveinis , Jeff Law , Segher Boessenkool , Richard Biener , Bernhard Reutner-Fischer , Trevor Saunders , Mike Stump Subject: [PATCHv5][PING] Vimrc config with GNU formatting References: <540863C1.4000909@samsung.com> <54100735.5040700@samsung.com> <541867A2.6020405@samsung.com> <5419C01C.2040404@samsung.com> <542D87DB.1080907@samsung.com> In-reply-to: <542D87DB.1080907@samsung.com> Content-type: multipart/mixed; boundary=------------050207030603000507060404 X-IsSubscribed: yes X-SW-Source: 2014-10/txt/msg01103.txt.bz2 This is a multi-part message in MIME format. --------------050207030603000507060404 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit Content-length: 1485 On 10/02/2014 09:14 PM, Yury Gribov wrote: > On 09/17/2014 09:08 PM, Yury Gribov wrote: > > On 09/16/2014 08:38 PM, Yury Gribov wrote: > >> Hi all, > >> > >> This is the third version of the patch. A list of changes since last > >> version: > >> * move config to contrib so that it's _not_ enabled by default (current > >> score is 2/1 in favor of no Vim config by default) > >> * update Makefile.in to make .local.vimrc if developer asks for it > >> * disable autoformatting for flex files > >> * fix filtering of non-GNU sources (libsanitizer) > >> * added some small fixes in cinoptions based on feedback from community > >> > >> As noted by Richard, the config does not do a good job of formatting > >> unbound {} blocks e.g. > >> void > >> foo () > >> { > >> int x; > >> { > >> // I'm an example of bad bad formatting > >> } > >> } > >> but it seems to be the best we can get with Vim's cindent > >> (and I don't think anyone seriously considers writing a custom > >> indentexpr). > >> > >> Ok to commit? > > > > New vesion with support for another popular local .vimrc plugin. > > Hi all, > > Here is a new vesion of vimrc patch. Hope I got email settings right > this time. > > Changes since v4: > * fixed and enhanced docs > * added support for .lvimrc in Makefile > * minor fixes in cinoptions and formatoptions (reported by Segher) > * removed shiftwidth settings (as it does not really relate to code > formatting) > > -Y > --------------050207030603000507060404 Content-Type: text/x-patch; name="local-vimrc-5.diff" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="local-vimrc-5.diff" Content-length: 3602 commit 3f560e9dd16a5e914b6f2ba82edffe13dfde944c Author: Yury Gribov Date: Thu Oct 2 15:50:52 2014 +0400 2014-10-02 Laurynas Biveinis Yury Gribov Vim config with GNU formatting. contrib/ * vimrc: New file. / * .gitignore: Added .local.vimrc and .lvimrc. * Makefile.tpl (vimrc, .lvimrc, .local.vimrc): New targets. * Makefile.in: Regenerate. diff --git a/.gitignore b/.gitignore index e9b56be..ab97ac6 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,9 @@ POTFILES TAGS TAGS.sub +.local.vimrc +.lvimrc + .gdbinit .gdb_history diff --git a/Makefile.in b/Makefile.in index d6105b3..f3a34af 100644 --- a/Makefile.in +++ b/Makefile.in @@ -2384,6 +2384,18 @@ mail-report-with-warnings.log: warning.log chmod +x $@ echo If you really want to send e-mail, run ./$@ now +# Local Vim config + +$(srcdir)/.local.vimrc: + $(LN_S) $(srcdir)/contrib/vimrc $@ + +$(srcdir)/.lvimrc: + $(LN_S) $(srcdir)/contrib/vimrc $@ + +vimrc: $(srcdir)/.local.vimrc $(srcdir)/.lvimrc + +.PHONY: vimrc + # Installation targets. .PHONY: install uninstall diff --git a/Makefile.tpl b/Makefile.tpl index f7c7e38..b98930c 100644 --- a/Makefile.tpl +++ b/Makefile.tpl @@ -867,6 +867,18 @@ mail-report-with-warnings.log: warning.log chmod +x $@ echo If you really want to send e-mail, run ./$@ now +# Local Vim config + +$(srcdir)/.local.vimrc: + $(LN_S) $(srcdir)/contrib/vimrc $@ + +$(srcdir)/.lvimrc: + $(LN_S) $(srcdir)/contrib/vimrc $@ + +vimrc: $(srcdir)/.local.vimrc $(srcdir)/.lvimrc + +.PHONY: vimrc + # Installation targets. .PHONY: install uninstall diff --git a/contrib/vimrc b/contrib/vimrc new file mode 100644 index 0000000..34e8f35 --- /dev/null +++ b/contrib/vimrc @@ -0,0 +1,45 @@ +" Code formatting settings for Vim. +" +" To enable this for GCC files by default, you can either source this file +" in your .vimrc via autocmd: +" :au BufNewFile,BufReadPost path/to/gcc/* :so path/to/gcc/contrib/vimrc +" or source the script manually for each newly opened file: +" :so contrib/vimrc +" You could also use numerous plugins that enable local vimrc e.g. +" mbr's localvimrc or thinca's vim-localrc (but note that the latter +" is much less secure). To install local vimrc config, run +" $ make vimrc +" from GCC build folder. +" +" Copyright (C) 2014 Free Software Foundation, Inc. +" +" This program is free software; you can redistribute it and/or modify +" it under the terms of the GNU General Public License as published by +" the Free Software Foundation; either version 3 of the License, or +" (at your option) any later version. +" +" This program is distributed in the hope that it will be useful, +" but WITHOUT ANY WARRANTY; without even the implied warranty of +" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +" GNU General Public License for more details. +" +" You should have received a copy of the GNU General Public License +" along with this program. If not, see . + +function! SetStyle() + let l:fname = expand("%:p") + if stridx(l:fname, 'libsanitizer') != -1 + return + endif + let l:ext = fnamemodify(l:fname, ":e") + let l:c_exts = ['c', 'h', 'cpp', 'cc', 'C', 'H', 'def', 'java'] + if index(l:c_exts, l:ext) != -1 + setlocal cindent + setlocal softtabstop=2 + setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,f0,h2,p4,t0,+2,(0,u0,w1,m0 + setlocal textwidth=80 + setlocal formatoptions-=ro formatoptions+=cqlt + endif +endfunction + +call SetStyle() --------------050207030603000507060404--