nvim: improvements to filetype
detection
This commit is contained in:
parent
448513ad70
commit
734c012556
1 changed files with 14 additions and 4 deletions
|
@ -2,13 +2,23 @@ local M = {}
|
||||||
|
|
||||||
M.setup = function()
|
M.setup = function()
|
||||||
vim.filetype.add {
|
vim.filetype.add {
|
||||||
|
-- 1. The file path/name is checked first.
|
||||||
|
filename = {
|
||||||
|
["clang-format"] = "yaml",
|
||||||
|
editorconfig = "editorconfig",
|
||||||
|
},
|
||||||
|
-- 2. Patterns are checked second.
|
||||||
pattern = {
|
pattern = {
|
||||||
["${HOME}/.ssh/config.d/.*"] = "sshconfig",
|
["${HOME}/.ssh/config.d/.*"] = "sshconfig",
|
||||||
[".*/ssh/config"] = "sshconfig",
|
|
||||||
|
-- Files in my dotfiles repository.
|
||||||
|
[".*/config/zsh/.*"] = "zsh",
|
||||||
[".*/git/config"] = "gitconfig",
|
[".*/git/config"] = "gitconfig",
|
||||||
[".*gitconfig"] = "gitconfig",
|
[".*/ssh/config"] = "sshconfig",
|
||||||
[".*/home/editorconfig"] = "editorconfig",
|
},
|
||||||
[".*config/zsh/.*"] = "zsh",
|
-- 3. Finally, the extension is checked.
|
||||||
|
extension = {
|
||||||
|
gitconfig = "gitconfig",
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue