summaryrefslogtreecommitdiff
path: root/nvim/lua/plugins/format.lua
diff options
context:
space:
mode:
author2025-04-21 15:15:42 +0300
committer2025-04-21 15:15:42 +0300
commit4d3bb0270aa6e76131fb12c191a07fde8cd819fe (patch)
tree400c190efd8944d95c67a73012180439949b97a7 /nvim/lua/plugins/format.lua
parent20.05.2025 - 2 (diff)
downloaddotfiles-4d3bb0270aa6e76131fb12c191a07fde8cd819fe.tar.gz
dotfiles-4d3bb0270aa6e76131fb12c191a07fde8cd819fe.tar.bz2
dotfiles-4d3bb0270aa6e76131fb12c191a07fde8cd819fe.tar.xz
dotfiles-4d3bb0270aa6e76131fb12c191a07fde8cd819fe.zip
Привёл nvim к достаточному состоянию
Diffstat (limited to 'nvim/lua/plugins/format.lua')
-rw-r--r--nvim/lua/plugins/format.lua29
1 files changed, 29 insertions, 0 deletions
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" }, "<leader>mp", function()
+ conform.format({ lsp_fallback = true, async = false, timeout_ms = 500 })
+end, { desc = "Format file or range (in visual mode)" })