diff --git a/init.lua b/init.lua index ed09ca4..6105300 100644 --- a/init.lua +++ b/init.lua @@ -223,12 +223,16 @@ vim.api.nvim_create_autocmd({ "FileType" }, { ---- conform.nvim ---- require("conform").setup({ + formatters_by_ft = { + terraform = { "terraform_fmt" } + }, format_on_save = { -- These options will be passed to conform.format() timeout_ms = 500, lsp_format = "fallback", }, }) +vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" ---- 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_next) vim.keymap.set("n", "q", vim.diagnostic.setloclist) - -- vim.keymap.set("n", "", function() - -- vim.lsp.buf.format({ async = true }) - -- end) end -- Use a loop to conveniently call 'setup' on multiple servers and @@ -380,27 +381,6 @@ vim.diagnostic.config({ -- 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 ---- local lint = require("lint") -- sqlfluff --