patch 9.2.0489: filetype: some Objective-C files are not recognized

Problem:  filetype: some Objective-C files are not recognized
Solution: Add g:filetype_mm override variable, improve the objective c
          pattern detection (Keith Smiley).

closes: #20221

Signed-off-by: Keith Smiley <keithbsmiley@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
Keith Smiley
2026-05-16 07:46:25 +00:00
committed by Christian Brabandt
parent 7cb86f46cb
commit bc7f736a39
4 changed files with 42 additions and 3 deletions
+31
View File
@@ -2068,6 +2068,37 @@ func Test_m4_file()
endtry
endfunc
func Test_mm_file()
filetype on
call writefile(['#import "test.h"'], 'Xfile.mm', 'D')
split Xfile.mm
call assert_equal('objcpp', &filetype)
bwipe!
call writefile(['// Objective-C++ line comment'], 'Xfile.mm', 'D')
split Xfile.mm
call assert_equal('objcpp', &filetype)
bwipe!
call writefile(['.TH VIM 1 "YYYY Mth DD"'], 'Xfile.mm', 'D')
split Xfile.mm
call assert_equal('nroff', &filetype)
bwipe!
try
let g:filetype_mm = 'objcpp'
call writefile(['.TH VIM 1 "YYYY Mth DD"'], 'Xfile_override.mm', 'D')
split Xfile_override.mm
call assert_equal('objcpp', &filetype)
bwipe!
finally
unlet! g:filetype_mm
endtry
filetype off
endfunc
func Test_mod_file()
filetype on