aboutsummaryrefslogtreecommitdiffstats
path: root/README.md
diff options
context:
space:
mode:
authorSteven Arcangeli <stevearc@stevearc.com>2023-11-04 13:24:48 -0700
committerSteven Arcangeli <stevearc@stevearc.com>2023-11-04 13:31:35 -0700
commit0bbe83830be5a07a1161bb1a23d7280310656177 (patch)
treec08a901c6ace758e9cfcaff49f5ba78837f79e40 /README.md
parent893b139e6dcdb55dee4c98215d9217d3a1ec69eb (diff)
feat: allow formatters_by_ft to be a function (#174)
Diffstat (limited to 'README.md')
-rw-r--r--README.md10
1 files changed, 9 insertions, 1 deletions
diff --git a/README.md b/README.md
index caf0a8c..96fb8d1 100644
--- a/README.md
+++ b/README.md
@@ -372,9 +372,17 @@ require("conform").setup({
formatters_by_ft = {
lua = { "stylua" },
-- Conform will run multiple formatters sequentially
- python = { "isort", "black" },
+ go = { "goimports", "gofmt" },
-- Use a sub-list to run only the first available formatter
javascript = { { "prettierd", "prettier" } },
+ -- You can use a function here to determine the formatters dynamically
+ python = function(bufnr)
+ if require("conform").get_formatter_info("ruff_format", bufnr).available then
+ return { "ruff_format" }
+ else
+ return { "isort", "black" }
+ end
+ end,
-- Use the "*" filetype to run formatters on all filetypes.
["*"] = { "codespell" },
-- Use the "_" filetype to run formatters on filetypes that don't