nvim: improvements to filetype detection

This commit is contained in:
Fernando Schauenburg 2025-03-05 10:17:28 +01:00
parent 448513ad70
commit 734c012556

View file

@ -2,13 +2,23 @@ local M = {}
M.setup = function()
vim.filetype.add {
-- 1. The file path/name is checked first.
filename = {
["clang-format"] = "yaml",
editorconfig = "editorconfig",
},
-- 2. Patterns are checked second.
pattern = {
["${HOME}/.ssh/config.d/.*"] = "sshconfig",
[".*/ssh/config"] = "sshconfig",
-- Files in my dotfiles repository.
[".*/config/zsh/.*"] = "zsh",
[".*/git/config"] = "gitconfig",
[".*gitconfig"] = "gitconfig",
[".*/home/editorconfig"] = "editorconfig",
[".*config/zsh/.*"] = "zsh",
[".*/ssh/config"] = "sshconfig",
},
-- 3. Finally, the extension is checked.
extension = {
gitconfig = "gitconfig",
},
}
end