neovim

mrgrouse's beloved, handmade neovim configuration
Log | Files | Refs | README

commit e39698682484a5224421d338cbf3d368c877365d
parent a4f1def15d4a3b477495b9e2a8b33fae8db6c566
Author: mrgrouse <bdmfegys@duck.com>
Date:   Wed,  2 Jul 2025 04:54:45 -0400

consolidate conform and mason plugin configs into one file to ensure proper ordering of plugins

Diffstat:
Dlua/plugins/conform.lua | 31-------------------------------
Alua/plugins/mason-conform-combined.lua | 60++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Dlua/plugins/mason.lua | 21---------------------
3 files changed, 60 insertions(+), 52 deletions(-)

diff --git a/lua/plugins/conform.lua b/lua/plugins/conform.lua @@ -1,31 +0,0 @@ -return { - "stevearc/conform.nvim", - --event = { "BufReadPre", "BufNewFile" }, - config = function() - local conform = require("conform") - - conform.setup({ - formatters_by_ft = { - json = { "prettier" }, - yaml = { "prettier" }, - markdown = { "prettier" }, - css = { "ast-grep" }, - html = { "ast-grep" }, - c = { "ast-grep" }, - --c++ = { "ast-grep" }, - --c# = { "ast-grep" }, - rust = { "ast-grep" }, - go = { "ast-grep" }, - java = { "ast-grep" }, - javascript = { "ast-grep" }, - python = { "ast-grep" }, - lua = { "ast-grep" }, - }, - --format_on_save = { - -- lsp_fallback = true, - -- async = false, - -- timeout_ms = 500, - --}, - }) - end, -} diff --git a/lua/plugins/mason-conform-combined.lua b/lua/plugins/mason-conform-combined.lua @@ -0,0 +1,60 @@ +return { + "williamboman/mason.nvim", + config = function() + -- import mason + local mason = require("mason") + + -- enable mason and configure icons + mason.setup({ + ui = { + icons = { + package_installed = "✓", + package_pending = "➜", + package_uninstalled = "✗", + }, + }, + }) + end, + "stevearc/conform.nvim", + event = { "BufWritePre" }, + cmd = { "ConformInfo" }, + keys = { + { + -- Customize or remove this keymap to your liking + "<leader>f", + function() + require("conform").format({ async = true }) + end, + mode = "", + desc = "Format buffer", + }, + }, + -- This will provide type hinting with LuaLS + ---@module "conform" + ---@type conform.setupOpts + opts = { + -- Define your formatters + formatters_by_ft = { + lua = { "stylua" }, + python = { "isort", "black" }, + javascript = { "prettierd", "prettier", stop_after_first = true }, + }, + -- Set default options + default_format_opts = { + lsp_format = "fallback", + }, + -- Set up format-on-save + format_on_save = { timeout_ms = 500 }, + -- Customize formatters + formatters = { + shfmt = { + prepend_args = { "-i", "2" }, + }, + }, + }, + init = function() + -- If you want the formatexpr, here is the place to set it + vim.o.formatexpr = "v:lua.require'conform'.formatexpr()" + end, + --"zapling/mason-conform.nvim", +} diff --git a/lua/plugins/mason.lua b/lua/plugins/mason.lua @@ -1,21 +0,0 @@ -return { - "williamboman/mason.nvim", - dependencies = { - "williamboman/mason-lspconfig.nvim", - }, - config = function() - -- import mason - local mason = require("mason") - - -- enable mason and configure icons - mason.setup({ - ui = { - icons = { - package_installed = "✓", - package_pending = "➜", - package_uninstalled = "✗", - }, - }, - }) - end, -}