Something went wrong. Try again.
This repository has no description
Something went wrong. Try again.
1234567891011121314151617181920212223242526272829303132333435363738394041local conform = require("conform")conform.setup({ notify_on_error = false, format_on_save = function(bufnr) -- Disable "format_on_save lsp_fallback" for languages that don't -- have a well standardized coding style. You can add additional -- languages here or re-enable it for the disabled ones. local disable_filetypes = { c = true, cpp = true } if disable_filetypes[vim.bo[bufnr].filetype] then return nil else return { timeout_ms = 500, lsp_format = "fallback", } end end, formatters_by_ft = { lua = { "stylua" }, -- Conform will run multiple formatters sequentially python = { "isort", "black" }, -- You can customize some of the format options for the filetype (:help conform.format) rust = { "rustfmt", lsp_format = "fallback" }, -- Conform will run the first available formatter javascript = { "prettierd", "prettier", stop_after_first = true }, },})
conform.formatters.stylua = { append_args = { "--collapse-simple-statement", "Always", },}vim.keymap.set( "n", "<leader>f", function() require("conform").format({ async = true, lsp_format = "fallback" }) end, { desc = "[f]ormat buffer" })