runtime(filetype): improve *.h filetype detection

This commit changes *.h files to default to C (instead of C++), and
deprecates the existing `g:c_syntax_for_h` and `g:ch_syntax_for_h`
variables in favor of a unified `g:filetype_h`, like is used for other
ambiguous file extensions.

closes: #17135

Signed-off-by: Amelia Clarke <selene@perilune.dev>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Amelia Clarke
2025-04-19 11:48:10 +02:00
committed by Christian Brabandt
parent 5ecb452f5b
commit 3041cf67d3
4 changed files with 47 additions and 20 deletions

View File

@ -1,7 +1,7 @@
" Vim support file to detect file types
"
" Maintainer: The Vim Project <https://github.com/vim/vim>
" Last Change: 2025 Apr 18
" Last Change: 2025 Apr 19
" Former Maintainer: Bram Moolenaar <Bram@vim.org>
" Listen very carefully, I will say this only once
@ -436,9 +436,8 @@ au BufNewFile,BufRead *.ixx,*.mpp setf cpp
" https://clang.llvm.org/docs/StandardCPlusPlusModules.html#file-name-requirement
au BufNewFile,BufRead *.cppm,*.ccm,*.cxxm,*.c++m setf cpp
" .h files can be C, Ch C++, ObjC or ObjC++.
" Set c_syntax_for_h if you want C, ch_syntax_for_h if you want Ch. ObjC is
" detected automatically.
" .h files can be C, C++, Ch, Objective-C, or Objective-C++.
" Set g_filetype_h to set a different filetype
au BufNewFile,BufRead *.h call dist#ft#FTheader()
" Ch (CHscript)