Files
dotfiles/config/nvim/plugin/conform.lua
T
gitadmin fe28d1bc73 refactor(config/nvim): move pack.add declarations into individual plugin files
The monolithic vim.pack.add() table in init.lua was removed and each
plugin/*.lua file now declares its own dependencies via vim.pack.add()
at the top. tools.lua was decomposed into per-plugin files (cmake.lua,
jupynvim.lua, just.lua, kulala.lua, mise.lua, neogit.lua, sshfs.lua,
trouble.lua, undotree.lua, zoxide.lua) each with their own config and
keymaps. This makes plugin files self-contained and easier to maintain.
2026-07-23 12:16:30 -04:00

43 lines
1.4 KiB
Lua

vim.pack.add({
{ src = 'https://github.com/stevearc/conform.nvim' },
})
local conform = require('conform')
conform.setup({
notify_on_error = false,
formatters = {
shfmt = {
prepend_args = { "-i", "2", "-ci" },
},
dprint = {
condition = function(ctx)
return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1]
end,
},
},
formatters_by_ft = {
c = { "clang_format" },
cpp = { "clang_format" },
lua = { 'stylua' },
go = { "goimports", "gofmt" },
rust = { "dprint", "rustfmt", lsp_format = "fallback" },
python = { "isort", "black", stop_after_first = true },
javascript = { "dprint", "prettier", stop_after_first = true },
markdown = { "dprint", "prettier", stop_after_first = true },
javascriptreact = { "dprint", "prettier", stop_after_first = true },
typescript = { "dprint", "prettier", stop_after_first = true },
typescriptreact = { "dprint", "prettier", stop_after_first = true },
svelte = { "dprint", "prettier", stop_after_first = true },
html = { "dprint", "prettier", stop_after_first = true },
},
})
vim.keymap.set({ 'n', 'v' }, '<leader>bf',
function()
conform.format { async = true, lsp_format = 'fallback' }
end,
{ desc = 'Format buffer' })