diff --git a/.config/nvim/lua/core/autocommands.lua b/.config/nvim/lua/core/autocommands.lua index 4059fd2..463f11e 100644 --- a/.config/nvim/lua/core/autocommands.lua +++ b/.config/nvim/lua/core/autocommands.lua @@ -48,6 +48,10 @@ vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, { ]]) end, }) +vim.api.nvim_create_autocmd("FileType", { + pattern = "hcl", + command = "setlocal shiftwidth=2 tabstop=2", +}) -- Disable some plugins on very large files vim.api.nvim_create_autocmd({ "BufEnter" }, { diff --git a/.config/nvim/lua/plugins/lsp/conform.lua b/.config/nvim/lua/plugins/lsp/conform.lua index cd21ab5..fd3ef03 100644 --- a/.config/nvim/lua/plugins/lsp/conform.lua +++ b/.config/nvim/lua/plugins/lsp/conform.lua @@ -8,6 +8,7 @@ require("conform").setup({ python = { "isort", "black" }, typescript = { "prettier" }, yaml = { "prettier" }, + hcl = { "terraform_fmt" }, }, formatters = { { @@ -16,7 +17,7 @@ require("conform").setup({ }, }, format_on_save = function(bufnr) - local filetypes = { "go", "typescript", "lua" } + local filetypes = { "go", "typescript", "lua", "hcl" } if not vim.tbl_contains(filetypes, vim.bo[bufnr].filetype) then return end