diff --git a/.config/nvim/lua/core/autocmds.lua b/.config/nvim/lua/core/autocmds.lua index b120eb9..241d097 100644 --- a/.config/nvim/lua/core/autocmds.lua +++ b/.config/nvim/lua/core/autocmds.lua @@ -73,32 +73,3 @@ vim.api.nvim_create_autocmd({ 'BufWritePre' }, { vim.fn.mkdir(vim.fn.fnamemodify(file, ':p:h'), 'p') end, }) - --- Set terraform-vars filetype to terraform -vim.api.nvim_create_autocmd('BufEnter', { - group = augroup('set_filetype_of_tfvars'), - pattern = '*', - callback = function() - if vim.bo.filetype == 'terraform-vars' then - vim.opt_local.filetype = 'terraform' - end - end, -}) - --- Set filetype to helm when the file is in certain paths -vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, { - group = augroup('set_filetype_of_helm'), - pattern = { '*/templates/*.yaml', '*/templates/*.tpl', '*.gotmpl', 'helmfile*.yaml' }, - callback = function() - vim.opt_local.filetype = 'helm' - end, -}) - --- Set filetype to sh for zsh file ending -vim.api.nvim_create_autocmd({ 'BufNewFile', 'BufRead' }, { - group = augroup('set_filetype_of_shell'), - pattern = { '*.zsh' }, - callback = function() - vim.opt_local.filetype = 'sh' - end, -}) diff --git a/.config/nvim/lua/plugins/filetype.lua b/.config/nvim/lua/plugins/filetype.lua new file mode 100644 index 0000000..c0c6a90 --- /dev/null +++ b/.config/nvim/lua/plugins/filetype.lua @@ -0,0 +1,20 @@ +return { + -- https://github.com/nathom/filetype.nvim + 'nathom/filetype.nvim', + lazy = false, + config = { + overrides = { + extensions = { + gotmpl = 'helm', + tf = 'terraform', + tfvars = 'terraform', + zsh = 'sh', + }, + complex = { + ['.*/templates/*.yaml'] = 'helm', + ['.*/templates/*.tpl'] = 'helm', + ['helmfile*.yaml'] = 'helm', + }, + }, + }, +}