To: vim_dev@googlegroups.com Subject: Patch 8.2.3726 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ------------ Patch 8.2.3726 Problem: README file in a config directory gets wrong filetype. Solution: Match README before patterns that match everything in a directory. Files: runtime/filetype.vim, src/testdir/test_filetype.vim *** ../vim-8.2.3725/runtime/filetype.vim 2021-11-30 13:02:55.120889114 +0000 --- runtime/filetype.vim 2021-12-03 11:31:53.491405251 +0000 *************** *** 123,129 **** " APT config file au BufNewFile,BufRead apt.conf setf aptconf au BufNewFile,BufRead */.aptitude/config setf aptconf ! au BufNewFile,BufRead */etc/apt/apt.conf.d/{[-_[:alnum:]]\+,[-_.[:alnum:]]\+.conf} setf aptconf " Arch Inventory file au BufNewFile,BufRead .arch-inventory,=tagging-method setf arch --- 123,129 ---- " APT config file au BufNewFile,BufRead apt.conf setf aptconf au BufNewFile,BufRead */.aptitude/config setf aptconf ! " more generic pattern far down " Arch Inventory file au BufNewFile,BufRead .arch-inventory,=tagging-method setf arch *************** *** 2159,2164 **** --- 2159,2170 ---- au StdinReadPost * if !did_filetype() | runtime! scripts.vim | endif + " Plain text files, needs to be far down to not override others. This avoids + " the "conf" type being used if there is a line starting with '#'. + " But before patterns matching everything in a directory. + au BufNewFile,BufRead *.text,README,LICENSE,COPYING,AUTHORS setf text + + " Extra checks for when no filetype has been detected now. Mostly used for " patterns that end in "*". E.g., "zsh*" matches "zsh.vim", but that's a Vim " script file. *************** *** 2173,2178 **** --- 2179,2187 ---- au BufNewFile,BufRead access.conf*,apache.conf*,apache2.conf*,httpd.conf*,srm.conf* call s:StarSetf('apache') au BufNewFile,BufRead */etc/apache2/*.conf*,*/etc/apache2/conf.*/*,*/etc/apache2/mods-*/*,*/etc/apache2/sites-*/*,*/etc/httpd/conf.*/*,*/etc/httpd/mods-*/*,*/etc/httpd/sites-*/*,*/etc/httpd/conf.d/*.conf* call s:StarSetf('apache') + " APT config file + au BufNewFile,BufRead */etc/apt/apt.conf.d/{[-_[:alnum:]]\+,[-_.[:alnum:]]\+.conf} call s:StarSetf('aptconf') + " Asterisk config file au BufNewFile,BufRead *asterisk/*.conf* call s:StarSetf('asterisk') au BufNewFile,BufRead *asterisk*/*voicemail.conf* call s:StarSetf('asteriskvm') *************** *** 2366,2375 **** au BufNewFile,BufRead zsh*,zlog* call s:StarSetf('zsh') - " Plain text files, needs to be far down to not override others. This avoids - " the "conf" type being used if there is a line starting with '#'. - au BufNewFile,BufRead *.text,README setf text - " Help files match *.txt but should have a last line that is a modeline. au BufNewFile,BufRead *.txt \ if getline('$') !~ 'vim:.*ft=help' --- 2375,2380 ---- *** ../vim-8.2.3725/src/testdir/test_filetype.vim 2021-11-30 13:02:55.120889114 +0000 --- src/testdir/test_filetype.vim 2021-12-03 11:26:34.147771251 +0000 *************** *** 502,508 **** \ 'tex': ['file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl'], \ 'texinfo': ['file.texinfo', 'file.texi', 'file.txi'], \ 'texmf': ['texmf.cnf'], ! \ 'text': ['file.text', 'README', '/usr/share/doc/bash-completion/AUTHORS'], \ 'tf': ['file.tf', '.tfrc', 'tfrc'], \ 'tidy': ['.tidyrc', 'tidyrc', 'tidy.conf'], \ 'tilde': ['file.t.html'], --- 502,508 ---- \ 'tex': ['file.latex', 'file.sty', 'file.dtx', 'file.ltx', 'file.bbl'], \ 'texinfo': ['file.texinfo', 'file.texi', 'file.txi'], \ 'texmf': ['texmf.cnf'], ! \ 'text': ['file.text', 'README', 'LICENSE', 'COPYING', 'AUTHORS', '/usr/share/doc/bash-completion/AUTHORS', '/etc/apt/apt.conf.d/README'], \ 'tf': ['file.tf', '.tfrc', 'tfrc'], \ 'tidy': ['.tidyrc', 'tidyrc', 'tidy.conf'], \ 'tilde': ['file.t.html'], *** ../vim-8.2.3725/src/version.c 2021-12-03 11:08:34.260842706 +0000 --- src/version.c 2021-12-03 11:40:40.486879889 +0000 *************** *** 755,756 **** --- 755,758 ---- { /* Add new patch number below this line */ + /**/ + 3726, /**/ -- Never under any circumstances take a sleeping pill and a laxative on the same night. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// \\\ \\\ sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ /// \\\ help me help AIDS victims -- http://ICCF-Holland.org ///