mirror of
https://github.com/dcarrillo/dotfiles.git
synced 2024-11-14 17:01:12 +00:00
[neovim] Format hcl files on save
This commit is contained in:
parent
32417a0bce
commit
6c42fb1c09
@ -48,6 +48,10 @@ vim.api.nvim_create_autocmd({ "BufNewFile", "BufRead" }, {
|
|||||||
]])
|
]])
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
vim.api.nvim_create_autocmd("FileType", {
|
||||||
|
pattern = "hcl",
|
||||||
|
command = "setlocal shiftwidth=2 tabstop=2",
|
||||||
|
})
|
||||||
|
|
||||||
-- Disable some plugins on very large files
|
-- Disable some plugins on very large files
|
||||||
vim.api.nvim_create_autocmd({ "BufEnter" }, {
|
vim.api.nvim_create_autocmd({ "BufEnter" }, {
|
||||||
|
@ -8,6 +8,7 @@ require("conform").setup({
|
|||||||
python = { "isort", "black" },
|
python = { "isort", "black" },
|
||||||
typescript = { "prettier" },
|
typescript = { "prettier" },
|
||||||
yaml = { "prettier" },
|
yaml = { "prettier" },
|
||||||
|
hcl = { "terraform_fmt" },
|
||||||
},
|
},
|
||||||
formatters = {
|
formatters = {
|
||||||
{
|
{
|
||||||
@ -16,7 +17,7 @@ require("conform").setup({
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
format_on_save = function(bufnr)
|
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
|
if not vim.tbl_contains(filetypes, vim.bo[bufnr].filetype) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user