mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
vim-patch:9.0.1601: filetype detection fails for *.conf file without comments (#23896)
Problem: Filetype detection fails for *.conf file without comments.
(Dmitrii Tcyganok)
Solution: Use "conf" filetype as a fallback for an empty .conf file.
(closes vim/vim#12487, closes vim/vim#12483)
664fd12aa2
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
This commit is contained in:
parent
72300feecf
commit
0a439e3863
@ -196,6 +196,9 @@ function M.conf(path, bufnr)
|
||||
if vim.fn.did_filetype() ~= 0 or path:find(vim.g.ft_ignore_pat) then
|
||||
return
|
||||
end
|
||||
if path:find('%.conf$') then
|
||||
return 'conf'
|
||||
end
|
||||
for _, line in ipairs(getlines(bufnr, 1, 5)) do
|
||||
if line:find('^#') then
|
||||
return 'conf'
|
||||
|
@ -121,7 +121,7 @@ let s:filename_checks = {
|
||||
\ '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'],
|
||||
|
Loading…
Reference in New Issue
Block a user