patch 9.1.1186: filetype: help files in git repos are not detected
Problem: filetype: help files in git repos are not detected
Solution: detect */doc/*.txt files as help if they end with a help
modeline, even if 'modeline' is off
Here's how I checked that this would still detect vim's own help files
correctly:
$ find . -type f -path '*/doc/*.txt' \
> -exec awk '{ } ENDFILE { print FILENAME ":" $0; }' '{}' + |
> grep -v 'vim:.*\<\(ft\|filetype\)=help\>'
./src/libvterm/doc/seqs.txt: 23 DECSM 42 = DECNRCM, national/multinational character
closes: #16817
Signed-off-by: David Mandelberg <david@mandelberg.org>
Signed-off-by: Christian Brabandt <cb@256bit.org>
diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim
index b6beb3f..521c0f6 100644
--- a/src/testdir/test_filetype.vim
+++ b/src/testdir/test_filetype.vim
@@ -919,8 +919,6 @@
'.zcompdump', '.zlogin', '.zlogout', '.zshenv', '.zshrc', '.zsh_history',
'.zcompdump-file', '.zlog', '.zlog-file', '.zsh', '.zsh-file',
'any/etc/zprofile', 'zlog', 'zlog-file', 'zsh', 'zsh-file'],
-
- help: [$VIMRUNTIME .. '/doc/help.txt'],
}
enddef
@@ -1626,6 +1624,23 @@
filetype off
endfunc
+func Test_help_file()
+ filetype on
+ call assert_true(mkdir('doc', 'pR'))
+
+ call writefile(['some text', 'vim:ft=help:'], 'doc/help.txt', 'D')
+ split doc/help.txt
+ call assert_equal('help', &filetype)
+ bwipe!
+
+ call writefile(['some text'], 'doc/nothelp.txt', 'D')
+ split doc/nothelp.txt
+ call assert_notequal('help', &filetype)
+ bwipe!
+
+ filetype off
+endfunc
+
func Test_hook_file()
filetype on
diff --git a/src/version.c b/src/version.c
index 1bfcbcb..5536a9b 100644
--- a/src/version.c
+++ b/src/version.c
@@ -705,6 +705,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 1186,
+/**/
1185,
/**/
1184,