1
0
Fork 0

conform: add terraform_fmt

This commit is contained in:
Felipe 2024-08-09 13:53:39 -04:00
parent 4f4d7a7985
commit 0ffa11edd9
Signed by: pitbuster
SSH key fingerprint: SHA256:OM3HeVSA96adfy2Gi8OhZkQBY67P88LoJUwkeVoTArQ

View file

@ -223,12 +223,16 @@ vim.api.nvim_create_autocmd({ "FileType" }, {
---- conform.nvim ---- ---- conform.nvim ----
require("conform").setup({ require("conform").setup({
formatters_by_ft = {
terraform = { "terraform_fmt" }
},
format_on_save = { format_on_save = {
-- These options will be passed to conform.format() -- These options will be passed to conform.format()
timeout_ms = 500, timeout_ms = 500,
lsp_format = "fallback", lsp_format = "fallback",
}, },
}) })
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
---- LuaSnip ---- LuaSnip
local luasnip = require("luasnip") local luasnip = require("luasnip")
@ -299,9 +303,6 @@ local on_lsp_attach = function(_client, _bufnr)
vim.keymap.set("n", "[d", vim.diagnostic.goto_prev) vim.keymap.set("n", "[d", vim.diagnostic.goto_prev)
vim.keymap.set("n", "]d", vim.diagnostic.goto_next) vim.keymap.set("n", "]d", vim.diagnostic.goto_next)
vim.keymap.set("n", "<Leader>q", vim.diagnostic.setloclist) vim.keymap.set("n", "<Leader>q", vim.diagnostic.setloclist)
-- vim.keymap.set("n", "<F3>", function()
-- vim.lsp.buf.format({ async = true })
-- end)
end end
-- Use a loop to conveniently call 'setup' on multiple servers and -- Use a loop to conveniently call 'setup' on multiple servers and
@ -380,27 +381,6 @@ vim.diagnostic.config({
-- silent = false -- true to suppress notifications -- silent = false -- true to suppress notifications
-- } -- }
-- -- Auto format on save
-- vim.api.nvim_create_autocmd({ "BufWritePre" }, {
-- callback = function()
-- if vim.b.disable_format then
-- return
-- end
-- local lsp_format = false
-- for _, client in pairs(vim.lsp.get_clients()) do
-- if client.server_capabilities.documentFormattingProvider then
-- lsp_format = true
-- break
-- end
-- end
-- if lsp_format then
-- vim.lsp.buf.format({ async = false })
-- else
-- vim.cmd("Format")
-- end
-- end,
-- })
---- nvim-lint ---- ---- nvim-lint ----
local lint = require("lint") local lint = require("lint")
-- sqlfluff -- -- sqlfluff --