From c04a16922992e187e84da3f47e852c45fb3529ad Mon Sep 17 00:00:00 2001 From: Christian Nieves Date: Wed, 5 Feb 2025 19:01:25 +0000 Subject: [PATCH] conform --- vim/.vim/lua/plugins/base.lua | 1 - vim/.vim/lua/plugins/conform.lua | 114 +++++++++++++++---------------- vim/.vim/lua/plugins/google.lua | 2 - 3 files changed, 55 insertions(+), 62 deletions(-) diff --git a/vim/.vim/lua/plugins/base.lua b/vim/.vim/lua/plugins/base.lua index a5c3286..b59e78f 100644 --- a/vim/.vim/lua/plugins/base.lua +++ b/vim/.vim/lua/plugins/base.lua @@ -25,7 +25,6 @@ return { { "MagicDuck/grug-far.nvim", config = function() - vim.g.maplocalleader = "," require("grug-far").setup({ -- search and replace engines configuration engines = { diff --git a/vim/.vim/lua/plugins/conform.lua b/vim/.vim/lua/plugins/conform.lua index b466835..2b666a8 100644 --- a/vim/.vim/lua/plugins/conform.lua +++ b/vim/.vim/lua/plugins/conform.lua @@ -2,76 +2,72 @@ local use_google = require("utils").use_google vim.g.disable_autoformat = false vim.api.nvim_create_user_command("FormatDisable", function(args) - if args.bang then - -- FormatDisable! will disable formatting just for this buffer - vim.b.disable_autoformat = true - else - vim.g.disable_autoformat = true - end + if args.bang then + -- FormatDisable! will disable formatting just for this buffer + vim.b.disable_autoformat = true + else + vim.g.disable_autoformat = true + end end, { - desc = "Disable autoformat-on-save", - bang = true, + desc = "Disable autoformat-on-save", + bang = true, }) - vim.api.nvim_create_user_command("FormatEnable", function() - vim.b.disable_autoformat = false - vim.g.disable_autoformat = false + vim.b.disable_autoformat = false + vim.g.disable_autoformat = false end, { - desc = "Re-enable autoformat-on-save", + desc = "Re-enable autoformat-on-save", }) vim.api.nvim_create_autocmd("BufWritePre", { - pattern = "*", - callback = function(args) - if vim.g.disable_autoformat or vim.b[args.buf].disable_autoformat then - return - end - require("conform").format({ bufnr = args.buf }) - end, + pattern = "*", + callback = function(args) + if vim.g.disable_autoformat or vim.b[args.buf].disable_autoformat then + return + end + require("conform").format({ bufnr = args.buf }) + end, }) return { - { - "stevearc/conform.nvim", - event = { "BufWritePre" }, - cmd = { "ConformInfo", "FormatDisable", "FormatEnable" }, - keys = { + { + "stevearc/conform.nvim", + event = { "BufWritePre" }, + cmd = { "ConformInfo", "FormatDisable", "FormatEnable" }, + keys = { -- stylua: ignore { "fmt", function() require("conform").format({ async = true, lsp_fallback = true }) end, mode = "", desc = "Format buffer", }, - }, - -- This will provide type hinting with LuaLS - ---@module "conform" - ---@type conform.setupOpts - opts = { - log_level = vim.log.levels.DEBUG, - formatters_by_ft = { + }, + -- This will provide type hinting with LuaLS + ---@module "conform" + ---@type conform.setupOpts + opts = { + log_level = vim.log.levels.DEBUG, + formatters_by_ft = { - rust = { "rustfmt", lsp_format = "fallback" }, - -- Conform will run multiple formatters sequentially - -- go = { "goimports", "gofmt" }, - -- Use a sub-list to run only the first available formatter - -- javascript = { { "prettierd", "prettier" } }, - lua = { "stylua" }, - -- Conform will run multiple formatters sequentially - python = { "isort", "black" }, - -- Use a sub-list to run only the first available formatter - javascript = { { "prettierd", "prettier" } }, - gdscript = { "gdformat" }, - dashboard = {}, - -- Use the "*" filetype to run formatters on all filetypes. - -- ["*"] = { "codespell" }, - -- Use the "_" filetype to run formatters on filetypes that don't - -- have other formatters configured. - ["_"] = { "trim_whitespace" }, - }, - format_on_save = function(bufnr) - -- Disable with a global or buffer-local variable - end, - formatters = { - gdformat = { - prepend_args = { "-l", "100" }, - }, - }, - }, - }, + rust = { "rustfmt", lsp_format = "fallback" }, + -- Conform will run multiple formatters sequentially + -- go = { "goimports", "gofmt" }, + -- Use a sub-list to run only the first available formatter + -- javascript = { { "prettierd", "prettier" } }, + lua = { "stylua" }, + -- Conform will run multiple formatters sequentially + python = { "isort", "black" }, + -- Use a sub-list to run only the first available formatter + javascript = { { "prettierd", "prettier" } }, + gdscript = { "gdformat" }, + dashboard = {}, + -- Use the "*" filetype to run formatters on all filetypes. + -- ["*"] = { "codespell" }, + -- Use the "_" filetype to run formatters on filetypes that don't + -- have other formatters configured. + ["_"] = { "trim_whitespace" }, + }, + formatters = { + gdformat = { + prepend_args = { "-l", "100" }, + }, + }, + }, + }, } diff --git a/vim/.vim/lua/plugins/google.lua b/vim/.vim/lua/plugins/google.lua index 095cb27..ccce7f1 100644 --- a/vim/.vim/lua/plugins/google.lua +++ b/vim/.vim/lua/plugins/google.lua @@ -276,8 +276,6 @@ return { }, -- here are some mappings you might want: keys = { - { "]c", ":CritiqueGotoNextComment" }, - { "[c", ":CritiqueGotoPrevComment" }, { "lc", ":CritiqueToggleLineComment" }, { "ac", ":CritiqueToggleAllComments" }, { "uc", ":CritiqueToggleUnresolvedComments" },