]> git.ipfire.org Git - thirdparty/gcc.git/blobdiff - contrib/vimrc
Update copyright years.
[thirdparty/gcc.git] / contrib / vimrc
index 34e8f3543f90ad1b7eac9d35bbdf69c3600d38e9..2f3456aedd8858ca2c5e15701b073d6e9787d6eb 100644 (file)
@@ -11,7 +11,7 @@
 "   $ make vimrc
 " from GCC build folder.
 " 
-" Copyright (C) 2014 Free Software Foundation, Inc.
+" Copyright (C) 2014-2024 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
 
 function! SetStyle()
   let l:fname = expand("%:p")
+  let l:ext = fnamemodify(l:fname, ":e")
+  let l:c_exts = ['c', 'h', 'cpp', 'cc', 'C', 'H', 'def', 'java']
   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
+  if l:ext != "py"
+    setlocal tabstop=8
     setlocal softtabstop=2
+    setlocal shiftwidth=2
+    setlocal noexpandtab
+  endif
+  if &filetype == "gitcommit"
+    setlocal textwidth=72
+  else
+    setlocal textwidth=79
+  endif
+  setlocal formatoptions-=ro formatoptions+=cqlt
+  if index(l:c_exts, l:ext) != -1 || &filetype == "c" || &filetype == "cpp"
+    setlocal cindent
     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