mirror of
https://github.com/neovim/neovim.git
synced 2025-12-16 03:15:39 +00: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:
@@ -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'
|
||||
|
||||
Reference in New Issue
Block a user