From 4d3bb0270aa6e76131fb12c191a07fde8cd819fe Mon Sep 17 00:00:00 2001 From: Alexander Neonxp Kiryukhin Date: Mon, 21 Apr 2025 15:15:42 +0300 Subject: =?UTF-8?q?=D0=9F=D1=80=D0=B8=D0=B2=D1=91=D0=BB=20nvim=20=D0=BA=20?= =?UTF-8?q?=D0=B4=D0=BE=D1=81=D1=82=D0=B0=D1=82=D0=BE=D1=87=D0=BD=D0=BE?= =?UTF-8?q?=D0=BC=D1=83=20=D1=81=D0=BE=D1=81=D1=82=D0=BE=D1=8F=D0=BD=D0=B8?= =?UTF-8?q?=D1=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nvim/lua/plugins/format.lua | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 nvim/lua/plugins/format.lua (limited to 'nvim/lua/plugins/format.lua') diff --git a/nvim/lua/plugins/format.lua b/nvim/lua/plugins/format.lua new file mode 100644 index 0000000..435222d --- /dev/null +++ b/nvim/lua/plugins/format.lua @@ -0,0 +1,29 @@ +local conform = require("conform") + +conform.setup({ + formatters_by_ft = { + javascript = { "prettier" }, + typescript = { "prettier" }, + javascriptreact = { "prettier" }, + typescriptreact = { "prettier" }, + svelte = { "prettier" }, + css = { "prettier" }, + html = { "prettier" }, + json = { "prettier" }, + yaml = { "prettier" }, + markdown = { "prettier" }, + graphql = { "prettier" }, + lua = { "stylua" }, + python = { "isort", "black" }, + go = { "gofmt" }, + }, + format_on_save = { + lsp_fallback = true, + async = false, + timeout_ms = 500, + }, +}) + +vim.keymap.set({ "n", "v" }, "mp", function() + conform.format({ lsp_fallback = true, async = false, timeout_ms = 500 }) +end, { desc = "Format file or range (in visual mode)" }) -- cgit v1.2.3