contrib/vimrc: detect more C-like files

Currently this script doesn't set the indentation style for the standard
library headers under libstdc++/ because they lack a file extension.
But they do have a modeline, so the file type is still set appropriately
by Vim.  So by inspecting &filetype, we can also detect these standard
library headers as C-like files.

contrib/ChangeLog:

	* vimrc (SetStyle): Also inspect &filetype to determine whether
	a file is C-like.
This commit is contained in:
Patrick Palka 2020-07-23 10:38:58 -04:00
parent 084dc63a02
commit 914966e499
1 changed files with 1 additions and 1 deletions

View File

@ -45,7 +45,7 @@ function! SetStyle()
setlocal textwidth=80 setlocal textwidth=80
endif endif
setlocal formatoptions-=ro formatoptions+=cqlt setlocal formatoptions-=ro formatoptions+=cqlt
if index(l:c_exts, l:ext) != -1 if index(l:c_exts, l:ext) != -1 || &filetype == "c" || &filetype == "cpp"
setlocal cindent setlocal cindent
setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,f0,h2,p4,t0,+2,(0,u0,w1,m0 setlocal cinoptions=>4,n-2,{2,^-2,:2,=2,g0,f0,h2,p4,t0,+2,(0,u0,w1,m0
endif endif