Search for the filetype. vim file in the vim installation directory
My options are/usr/share/vim/vim72/filetype. vim.
Open it and search for inc
I found the following: 1360-1365 was added later.
From 1347, we can see that the. inc file is used as a format to parse the highlighted syntax.
The following is a function call s: FTinc ()
It means that the first three rows of the file, getline (1). getline (2). getline (3), find that there is a XX string.
In the first three rows, '/\ ** filetype * = * cpp * \ */' or '/\ ** filetype * = * c * \ */' appears *\*/'' # * filetype * = * make * 'is used as the file.
Of course, if the above problem occurs at the same time, the last occurrence prevails-the state machine.
I hope to help you.
1346 "Povray, PHP or assembly
1347 au BufNewFile, BufRead *. inc call s: FTinc ()
1348
1349 func! S: FTinc ()
1350 if exists ("g: filetype_inc ")
1351 exe "setf". g: filetype_inc
1352 else
1353 let lines = getline (1). getline (2). getline (3)
1354 if lines = ~? "Perlscript"
1355 setf aspperl
1356 elseif lines = ~ "<%"
1357 setf aspvbs
1358 elseif lines = ~ "<? "
1359 setf php
1360 elseif lines = ~ '/\ ** Filetype * = * cpp *\*/'
1361 setf cpp
1362 elseif lines = ~ '/\ ** Filetype * = * c *\*/'
1363 setf c
1364 elseif lines = ~ '# * Filetype * = * make *'
1365 setf make
1366 else
1367 call s: FTasmsyntax ()
1368 if exists ("B: asmsyntax ")
1369 exe "setf". fnameescape (B: asmsyntax)
1370 else
1371 setf pov
1372 endif
1373 endif
1374 endif
1375 endfunc
Author dengxu11