But it is not working. I also tried in a buffer with :lua vim.filetype.add({ filename = { ['.kube/config'] = 'yaml' } }) and/or with the filename as absolute path(like /Users/hans/.kube/config, I use macOS btw) but all of those are not working.
Only :set filetype=yaml for a buffer works.
What I missed?
FYI:
This is the commit on this and you can check all configs from that dotfiles repo.
It is fine to put vim.filetype.add() in your init.vim or init.lua file. It does not need to be in a separate filetype.lua file.
The “filename” key matches on the file name exactly. That is why it only works for either absolute paths or on just the name of the file itself (not the path of the file). To match on a subpath, use the “pattern” key: