diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-06-03 17:56:30 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2023-06-03 17:56:30 +0100 |
commit | 664fd12aa27a3c6bd19cfa474c4630d6c03fcc61 (patch) | |
tree | 8eeda3affb7b7dd9ce2ecccd010c4f3b5ddbfd5f | |
parent | f0e68c0e2a3539f899e737e5b167622fe081fbbd (diff) |
patch 9.0.1601: filetype detection fails for *.conf file without commentsv9.0.1601
Problem: Filetype detection fails for *.conf file without comments.
(Dmitrii Tcyganok)
Solution: Use "conf" filetype as a fallback for an empty .conf file.
(closes #12487, closes #12483)
-rw-r--r-- | runtime/filetype.vim | 6 | ||||
-rw-r--r-- | src/testdir/test_filetype.vim | 2 | ||||
-rw-r--r-- | src/version.c | 2 |
3 files changed, 7 insertions, 3 deletions
diff --git a/runtime/filetype.vim b/runtime/filetype.vim index 4be0f18a7d..e9116688af 100644 --- a/runtime/filetype.vim +++ b/runtime/filetype.vim @@ -2811,8 +2811,10 @@ augroup END " Generic configuration file. Use FALLBACK, it's just guessing! au filetypedetect BufNewFile,BufRead,StdinReadPost * \ if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat - \ && (getline(1) =~ '^#' || getline(2) =~ '^#' || getline(3) =~ '^#' - \ || getline(4) =~ '^#' || getline(5) =~ '^#') | + \ && (expand("<amatch>") =~# '\.conf$' + \ || getline(1) =~ '^#' || getline(2) =~ '^#' + \ || getline(3) =~ '^#' || getline(4) =~ '^#' + \ || getline(5) =~ '^#') | \ setf FALLBACK conf | \ endif diff --git a/src/testdir/test_filetype.vim b/src/testdir/test_filetype.vim index 0684383ee4..6e03a70c8e 100644 --- a/src/testdir/test_filetype.vim +++ b/src/testdir/test_filetype.vim @@ -122,7 +122,7 @@ def s:GetFilenameChecks(): dict<list<string>> cobol: ['file.cbl', 'file.cob', 'file.lib'], coco: ['file.atg'], conaryrecipe: ['file.recipe'], - conf: ['auto.master'], + conf: ['auto.master', 'file.conf'], config: ['configure.in', 'configure.ac', '/etc/hostname.file', 'any/etc/hostname.file'], confini: ['/etc/pacman.conf', 'any/etc/pacman.conf', 'mpv.conf', 'any/.aws/config', 'any/.aws/credentials', 'file.nmconnection'], context: ['tex/context/any/file.tex', 'file.mkii', 'file.mkiv', 'file.mkvi', 'file.mkxl', 'file.mklx'], diff --git a/src/version.c b/src/version.c index b854893fc3..e373686ab5 100644 --- a/src/version.c +++ b/src/version.c @@ -696,6 +696,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ /**/ + 1601, +/**/ 1600, /**/ 1599, |