summaryrefslogtreecommitdiffstats
path: root/runtime
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-06-03 17:56:30 +0100
committerBram Moolenaar <Bram@vim.org>2023-06-03 17:56:30 +0100
commit664fd12aa27a3c6bd19cfa474c4630d6c03fcc61 (patch)
tree8eeda3affb7b7dd9ce2ecccd010c4f3b5ddbfd5f /runtime
parentf0e68c0e2a3539f899e737e5b167622fe081fbbd (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)
Diffstat (limited to 'runtime')
-rw-r--r--runtime/filetype.vim6
1 files changed, 4 insertions, 2 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