add yaml formatter

This commit is contained in:
jc 2024-07-17 18:31:10 -04:00
commit 9f4dc0aced
No known key found for this signature in database

View file

@ -31,22 +31,23 @@ return {
"stevearc/conform.nvim", "stevearc/conform.nvim",
config = function() config = function()
require("conform").setup({ require("conform").setup({
formatters_by_ft = { formatters_by_ft = {
lua = { "stylua" }, lua = { "stylua" },
javascript = { "prettierd" }, javascript = { "prettierd" },
typescript = { "prettierd" }, typescript = { "prettierd" },
javascriptreact = { "prettierd" }, javascriptreact = { "prettierd" },
typescriptreact = { "prettierd" }, typescriptreact = { "prettierd" },
go = { "gofumpt" }, go = { "gofumpt" },
python = { "autopep8" }, python = { "autopep8" },
}, yaml = { "yamlfmt" },
format_on_save = function(bufnr) },
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then format_on_save = function(bufnr)
return if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
end return
return { timeout_ms = 500, lsp_fallback = true } end
end, return { timeout_ms = 500, lsp_fallback = true }
}) end,
})
vim.api.nvim_create_user_command("FormatDisable", function() vim.api.nvim_create_user_command("FormatDisable", function()
vim.g.disable_autoformat = true vim.g.disable_autoformat = true