1
0
mirror of https://github.com/dcarrillo/dotfiles.git synced 2025-07-03 12:19:26 +00:00

[neovim] Use conform plugin for auto formatting

This commit is contained in:
2024-06-08 15:09:31 +02:00
parent db10008f9b
commit 29a97b4aa3
9 changed files with 45 additions and 37 deletions

View File

@ -0,0 +1,26 @@
require("conform").setup({
formatters_by_ft = {
go = { "goimports", "gofumpt" },
javascript = { "prettier" },
json = { "prettier" },
lua = { "stylua" },
markdown = { "prettier" },
python = { "isort", "black" },
typescript = { "prettier" },
yaml = { "prettier" },
},
formatters = {
{
command = "black",
args = { "--line-length", "100" },
},
},
format_on_save = function(bufnr)
local filetypes = { "go", "typescript", "lua" }
if not vim.tbl_contains(filetypes, vim.bo[bufnr].filetype) then
return
end
return { timeout_ms = 500, lsp_fallback = false }
end,
})