patch 9.1.1304: filetype: some man files are not recognized
Problem: filetype: some man files are not recognized
(e.g. 1p (POSIX commands))
Solution: update the filetype detection pattern and detect more man
files as nroff (Eisuke Kawashima)
- sections are revised referring to
- debian-12:/etc/manpath.config
- fedora-41:/etc/man_db.conf
- detection logic is improved
- detection test is implemented
closes: #17117
Signed-off-by: Eisuke Kawashima <e-kwsm@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index a56e1ac..98dba23 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -2889,6 +2889,20 @@
filetype off
endfunc
+func Test_nroff_file()
+ filetype on
+
+ call writefile(['.TH vim 1 "YYYY Mth DD"'], 'Xfile.1', 'D')
+ split Xfile.1
+ call assert_equal('nroff', &filetype)
+ bwipe!
+
+ call writefile(['. /etc/profile'], 'Xfile.1', 'D')
+ split Xfile.1
+ call assert_notequal('nroff', &filetype)
+ bwipe!
+endfunc
+
func Test_org_file()
filetype on
diff --git a/src/version.c b/src/version.c
index e2314ca..30904d7 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1304,
+/**/
1303,
/**/
1302,