From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17636 invoked by alias); 4 Sep 2014 13:06:09 -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 17626 invoked by uid 89); 4 Sep 2014 13:06:08 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,T_HDRS_LCASE,T_MANY_HDRS_LCASE autolearn=ham version=3.3.2 X-HELO: mailout3.w1.samsung.com Received: from mailout3.w1.samsung.com (HELO mailout3.w1.samsung.com) (210.118.77.13) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (DES-CBC3-SHA encrypted) ESMTPS; Thu, 04 Sep 2014 13:06:05 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NBD00LIVOISA420@mailout3.w1.samsung.com> for gcc-patches@gcc.gnu.org; Thu, 04 Sep 2014 14:08:52 +0100 (BST) Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 87.A2.15956.9B368045; Thu, 04 Sep 2014 14:06:01 +0100 (BST) Received: from [106.109.9.145] by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NBD00DT8OE00HA0@eusync1.samsung.com>; Thu, 04 Sep 2014 14:06:00 +0100 (BST) Message-id: <540863C1.4000909@samsung.com> Date: Thu, 04 Sep 2014 13:06:00 -0000 From: Yury Gribov User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.0 MIME-version: 1.0 To: GCC Patches Cc: Laurynas Biveinis , Jeff Law Subject: Vimrc config with GNU formatting Content-type: multipart/mixed; boundary=------------090408050306090802040001 X-IsSubscribed: yes X-SW-Source: 2014-09/txt/msg00340.txt.bz2 This is a multi-part message in MIME format. --------------090408050306090802040001 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-length: 316 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? -Y --------------090408050306090802040001 Content-Type: text/x-diff; name="local-vimrc-1.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="local-vimrc-1.diff" Content-length: 1714 commit dd961868f625f2f3b3ac9c4349284904cdd56ad1 Author: Yury Gribov Date: Thu Sep 4 16:55:44 2014 +0400 2014-09-04 Laurynas Biveinis Yury Gribov * .local.vimrc: New file. diff --git a/.local.vimrc b/.local.vimrc new file mode 100644 index 0000000..58e6ad3 --- /dev/null +++ b/.local.vimrc @@ -0,0 +1,36 @@ +" Vim settings. +" +" To autorun install thinca's localrc plugin. Otherwise just source via +" :so .local.vimrc + +" 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() +" TODO: filter out non-GNU sources e.g. libsanitizer? +let l:fname = expand("%:p") +let l:ext = fnamemodify(l:fname, ":e") +let l:c_exts = [ 'c', 'h', 'cpp', 'cc', 'C', 'H', 'def', 'java', 'l' ] +if index(l:c_exts, l:ext) != -1 + setlocal cindent + setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,h2,p5,t0,+2,(0,u0,w1,m1 + setlocal shiftwidth=2 + setlocal softtabstop=2 + setlocal textwidth=79 + setlocal fo-=ro fo+=cql +endif +endfunction + +call SetStyle() --------------090408050306090802040001--