On Mon, 2 Sep 2019, Martin Liška wrote:

> > If that's the case, we should look into overriding 'tabstop' for all files 
> > in
> > the gcc tree, including .md files, not just .pd and C/C++ files, right?
> 
> Can be done but we don't have any 'au BufRead *.md' rule right now.

The solution I had in mind was to set expected formatting for all files in our
local vimrc like this:

--- a/contrib/vimrc
+++ b/contrib/vimrc
@@ -31,17 +31,17 @@ function! SetStyle()
   if stridx(l:fname, 'libsanitizer') != -1
     return
   endif
+  setlocal tabstop=8
+  setlocal softtabstop=2
+  setlocal shiftwidth=2
+  setlocal noexpandtab
+  setlocal textwidth=80
+  setlocal formatoptions-=ro formatoptions+=cqlt
   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 tabstop=8
-    setlocal softtabstop=2
-    setlocal shiftwidth=2
-    setlocal noexpandtab
     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


Alexander

Reply via email to