" $ 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