Skip to content

Commit 7e10d80

Browse files
committed
formatter
1 parent ebd68fb commit 7e10d80

File tree

1 file changed

+29
-4
lines changed

1 file changed

+29
-4
lines changed

lua/custom/plugins/format.lua

Lines changed: 29 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,37 @@ return { -- Autoformat
2525
end,
2626
formatters_by_ft = {
2727
lua = { "stylua" },
28-
-- Conform can also run multiple formatters sequentially
29-
-- python = { "isort", "black" },
30-
--
3128
-- You can use a sub-list to tell conform to run *until* a formatter
3229
-- is found.
33-
-- javascript = { { "prettierd", "prettier" } },
30+
typescript = { { "dprint", "prettier" } },
31+
html = { "prettier" },
32+
css = { "prettier" },
33+
scss = { "prettier" },
34+
php = { "php-cs-fixer" },
35+
-- Conform can also run multiple formatters sequentially
36+
python = { "isort", "black" },
37+
},
38+
-- LazyVim will merge the options you set here with builtin formatters.
39+
-- You can also define any custom formatters here.
40+
---@type table<string,table>
41+
formatters = {
42+
injected = { options = { ignore_errors = true } },
43+
-- # Example of using dprint only when a dprint.json file is present
44+
dprint = {
45+
condition = function(ctx)
46+
return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1]
47+
end,
48+
},
49+
prettier = {
50+
condition = function(ctx)
51+
return vim.fs.find({ ".prettierrc" }, { path = ctx.filename, upward = true })[1]
52+
end,
53+
},
54+
--
55+
-- Example of using shfmt with extra args
56+
shfmt = {
57+
extra_args = { "-i", "2", "-ci" },
58+
},
3459
},
3560
},
3661
}

0 commit comments

Comments
 (0)