Mercurial > hg > CbC > CbC_gcc
comparison contrib/vimrc @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children | 1830386684a0 |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
1 " Code formatting settings for Vim. | |
2 " | |
3 " To enable this for GCC files by default, you can either source this file | |
4 " in your .vimrc via autocmd: | |
5 " :au BufNewFile,BufReadPost path/to/gcc/* :so path/to/gcc/contrib/vimrc | |
6 " or source the script manually for each newly opened file: | |
7 " :so contrib/vimrc | |
8 " You could also use numerous plugins that enable local vimrc e.g. | |
9 " mbr's localvimrc or thinca's vim-localrc (but note that the latter | |
10 " is much less secure). To install local vimrc config, run | |
11 " $ make vimrc | |
12 " from GCC build folder. | |
13 " | |
14 " Copyright (C) 2014 Free Software Foundation, Inc. | |
15 " | |
16 " This program is free software; you can redistribute it and/or modify | |
17 " it under the terms of the GNU General Public License as published by | |
18 " the Free Software Foundation; either version 3 of the License, or | |
19 " (at your option) any later version. | |
20 " | |
21 " This program is distributed in the hope that it will be useful, | |
22 " but WITHOUT ANY WARRANTY; without even the implied warranty of | |
23 " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
24 " GNU General Public License for more details. | |
25 " | |
26 " You should have received a copy of the GNU General Public License | |
27 " along with this program. If not, see <http://www.gnu.org/licenses/>. | |
28 | |
29 function! SetStyle() | |
30 let l:fname = expand("%:p") | |
31 if stridx(l:fname, 'libsanitizer') != -1 | |
32 return | |
33 endif | |
34 let l:ext = fnamemodify(l:fname, ":e") | |
35 let l:c_exts = ['c', 'h', 'cpp', 'cc', 'C', 'H', 'def', 'java'] | |
36 if index(l:c_exts, l:ext) != -1 | |
37 setlocal cindent | |
38 setlocal tabstop=8 | |
39 setlocal softtabstop=2 | |
40 setlocal shiftwidth=2 | |
41 setlocal noexpandtab | |
42 setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,f0,h2,p4,t0,+2,(0,u0,w1,m0 | |
43 setlocal textwidth=80 | |
44 setlocal formatoptions-=ro formatoptions+=cqlt | |
45 endif | |
46 endfunction | |
47 | |
48 call SetStyle() |