public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Vimrc config with GNU formatting
@ 2014-09-04 13:06 Yury Gribov
  2014-09-04 13:22 ` Richard Biener
  2014-09-10  8:09 ` [PATCHv2] " Yury Gribov
  0 siblings, 2 replies; 44+ messages in thread
From: Yury Gribov @ 2014-09-04 13:06 UTC (permalink / raw)
  To: GCC Patches; +Cc: Laurynas Biveinis, Jeff Law

[-- Attachment #1: Type: text/plain, Size: 316 bytes --]

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

[-- Attachment #2: local-vimrc-1.diff --]
[-- Type: text/x-diff, Size: 1714 bytes --]

commit dd961868f625f2f3b3ac9c4349284904cdd56ad1
Author: Yury Gribov <y.gribov@samsung.com>
Date:   Thu Sep 4 16:55:44 2014 +0400

    2014-09-04  Laurynas Biveinis  <laurynas.biveinis@gmail.com>
    	    Yury Gribov  <y.gribov@samsung.com>
    
    	* .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 <http://www.gnu.org/licenses/>.
+
+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()

^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2014-12-08 21:46 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-09-04 13:06 Vimrc config with GNU formatting Yury Gribov
2014-09-04 13:22 ` Richard Biener
2014-09-04 20:23   ` Bernhard Reutner-Fischer
2014-09-05 15:10     ` Yury Gribov
2014-09-05 16:46       ` Bernhard Reutner-Fischer
2014-09-06 16:33         ` Yury Gribov
2014-09-05 17:35       ` Segher Boessenkool
2014-09-06 15:40         ` Yury Gribov
2014-09-06 18:21           ` Trevor Saunders
2014-09-06 19:35           ` Segher Boessenkool
2014-09-07  4:18             ` Yuri Gribov
2014-09-07  4:48               ` Yuri Gribov
2014-09-07 13:33               ` Segher Boessenkool
2014-09-05 15:04   ` Yury Gribov
2014-09-10  8:09 ` [PATCHv2] " Yury Gribov
2014-09-10  8:17   ` Yury Gribov
2014-09-10 19:17   ` Segher Boessenkool
2014-09-11  4:47     ` Yury Gribov
2014-09-11  9:14       ` pinskia
2014-09-11  9:35         ` Yury Gribov
2014-09-11  9:06   ` Richard Biener
2014-09-11  9:18     ` Richard Biener
2014-09-11 10:10       ` Yury Gribov
2014-09-11 16:07         ` Yury Gribov
2014-09-14 10:32           ` Alexander Monakov
2014-09-15  9:54             ` Yury Gribov
2014-09-16 16:38   ` [PATCHv3] " Yury Gribov
2014-09-16 21:59     ` Trevor Saunders
2014-09-17 13:02       ` Segher Boessenkool
2014-09-17 14:05         ` Yury Gribov
2014-09-17 14:10           ` Yury Gribov
2014-09-17 17:08     ` [PATCHv4] " Yury Gribov
2014-09-18  3:54       ` Segher Boessenkool
2014-09-18  8:39         ` Yury Gribov
2014-09-18 15:37           ` Mike Stump
2014-09-18 17:20           ` Segher Boessenkool
2014-09-19  4:17             ` Yury Gribov
2014-09-19 11:11               ` Segher Boessenkool
2014-10-02 17:14       ` [PATCHv5] " Yury Gribov
2014-10-13 10:33         ` [PATCHv5][PING] " Yury Gribov
2014-10-21 15:24           ` [PATCHv5][PING^2] " Yury Gribov
2014-11-06 10:31             ` [PATCHv5][PING^3] " Yury Gribov
2014-11-28 18:00               ` [PATCHv5][PING^4] " Yury Gribov
2014-12-08 21:46                 ` Jeff Law

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).