summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/config/plugins/conform.lua
diff options
context:
space:
mode:
authorTom Li Dobnik <tomlidobnik1@gmail.com>2025-08-09 17:12:43 +0200
committerTom Li Dobnik <tomlidobnik1@gmail.com>2025-08-09 17:12:43 +0200
commitea82cbb1c0b778dd946c717cceace53fab391ba8 (patch)
treef0c84a86f48d61d918b6de9dc464c08370ab6a7c /.config/nvim/lua/config/plugins/conform.lua
init
Diffstat (limited to '.config/nvim/lua/config/plugins/conform.lua')
-rw-r--r--.config/nvim/lua/config/plugins/conform.lua33
1 files changed, 33 insertions, 0 deletions
diff --git a/.config/nvim/lua/config/plugins/conform.lua b/.config/nvim/lua/config/plugins/conform.lua
new file mode 100644
index 0000000..afc2dd5
--- /dev/null
+++ b/.config/nvim/lua/config/plugins/conform.lua
@@ -0,0 +1,33 @@
+return {
+ "stevearc/conform.nvim",
+ event = "VeryLazy",
+ keys = {
+ {
+ "<leader>f",
+ function()
+ require("conform").format({ async = true, lsp_format = "fallback" })
+ end,
+ mode = "",
+ desc = "Format buffer",
+ },
+ },
+
+ opts = {
+ formatters_by_ft = {
+ lua = { "stylua" },
+ python = { "isort", "black" },
+ rust = { "rustfmt" },
+ javascript = { "prettierd", "prettier", stop_after_first = true },
+ typescript = { "prettierd", "prettier", stop_after_first = true },
+ typescriptreact = { "prettierd", "prettier", stop_after_first = true },
+ css = { "prettierd", "prettier", stop_after_first = true },
+ html = { "prettierd", "prettier", stop_after_first = true },
+ htmldjango = { "djlint" },
+ typst = { "prettypst" },
+ },
+ format_on_save = {
+ timeout_ms = 500,
+ lsp_format = "fallback",
+ },
+ },
+}