This commit is contained in:
Christian Nieves
2024-10-21 22:33:08 +00:00
parent f237b861fc
commit 50761bc157
4 changed files with 204 additions and 241 deletions

View File

@ -1,3 +1,9 @@
local use_google = require("utils").use_google
if use_google() then
return {}
end
vim.api.nvim_create_user_command("FormatDisable", function(args)
if args.bang then
-- FormatDisable! will disable formatting just for this buffer
@ -20,16 +26,10 @@ return {
{
"stevearc/conform.nvim",
event = { "BufWritePre" },
cmd = { "ConformInfo" },
cmd = { "ConformInfo", "Format", "FormatDisable", "FormatEnable" },
keys = {
{
"<leader>fmt",
function()
require("conform").format({ async = true, lsp_fallback = true })
end,
mode = "",
desc = "Format buffer",
},
-- stylua: ignore
{ "<leader>fmt", function() require("conform").format({ async = true, lsp_fallback = true }) end, mode = "", desc = "Format buffer", },
},
opts = {
formatters_by_ft = {
@ -55,7 +55,7 @@ return {
if vim.g.disable_autoformat or vim.b[bufnr].disable_autoformat then
return
end
return { timeout_ms = 500, lsp_fallback = true }
return { timeout_ms = 500, lsp_format = "fallback" }
end,
formatters = {
gdformat = {