Skip to content

Commit

Permalink
Add conform for better formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
cschindlbeck committed Aug 28, 2024
1 parent 879399d commit e1ac615
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions lua/plugins/formatter.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
return {
"stevearc/conform.nvim",
opts = {},
config = function()
require("conform").setup({
formatters = {
yamlfmt = {
command = "yamlfmt", -- Ensure yamlfmt is in your PATH
args = {
"-formatter",
"type=basic,include_document_start=true,max_line_length=120,retain_line_breaks_single=true,indentless_arrays=false,pad_line_comments=2",
},
stdin = true, -- Makes yamlfmt read from stdin
},
},
formatters_by_ft = {
yaml = { "yamlfmt", stop_after_first = true },
},
format_on_save = {
-- These options will be passed to conform.format()
timeout_ms = 500,
lsp_format = "fallback",
},
})
end,
}

0 comments on commit e1ac615

Please sign in to comment.