Initial commit
This commit is contained in:
42
lua/plugins/conform.lua
Normal file
42
lua/plugins/conform.lua
Normal file
@@ -0,0 +1,42 @@
|
||||
return {
|
||||
"stevearc/conform.nvim",
|
||||
event = { "BufWritePre" },
|
||||
keys = {
|
||||
{
|
||||
"<leader>cf",
|
||||
function()
|
||||
require("conform").format({ async = true, lsp_fallback = true })
|
||||
end,
|
||||
desc = "Format buffer"
|
||||
},
|
||||
{
|
||||
"<leader>cF",
|
||||
function()
|
||||
require("conform").format({ formatters = { "injected" } })
|
||||
end,
|
||||
desc = "Format injected langs"
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
formatters_by_ft = {
|
||||
javascript = { "prettier" },
|
||||
typescript = { "prettier" },
|
||||
javascriptreact = { "prettier" },
|
||||
typescriptreact = { "prettier" },
|
||||
css = { "prettier" },
|
||||
html = { "prettier" },
|
||||
json = { "prettier" },
|
||||
yaml = { "prettier" },
|
||||
markdown = { "prettier" },
|
||||
lua = { "stylelua" },
|
||||
python = { "black" },
|
||||
php = { "php_cs_fixer" },
|
||||
go = { "gofmt" },
|
||||
rurst = { "rustfmt" },
|
||||
},
|
||||
format_on_save = {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = true
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user