refactor filetype function + add docker compose fix

This commit is contained in:
Gilad Sher 2024-06-11 15:41:47 -04:00
parent 1a7bee8041
commit fc3cdeaad9
1 changed files with 10 additions and 6 deletions

View File

@ -1,6 +1,10 @@
vim.cmd([[
augroup filetypedetect
autocmd! BufRead,BufNewFile .swcrc setfiletype json
autocmd! BufRead,BufNewFile .prettierrc setfiletype json
augroup END
]])
local function set_filetype(pattern, filetype)
vim.api.nvim_create_autocmd({ 'BufRead', 'BufNewFile' }, {
pattern = pattern,
command = 'set filetype=' .. filetype,
})
end
set_filetype('.swcrc', 'json')
set_filetype('.prettierrc', 'json')
set_filetype('docker-compose.yml', 'yaml.docker-compose')