Files
nvim/lua/plugins/conform.lua
zias 6ec8190beb refactor: modularize nvim config into lua/config + lua/plugins
- Extract all options, keymaps, and autocommands into lua/config/
- Move every plugin spec into its own file under lua/plugins/
- Add custom inline orng colorscheme (dark + light) synced to macOS appearance
- Consolidate image.nvim into pdf-viewer.lua (fix duplicate spec)
- Fix image.nvim processor: magick -> magick_cli
- Remove conflicting nvim-autopairs (kept mini.pairs)
- Fix broken <C-f> keymap (was calling non-existent builtin cmd)
- Delete lua/kickstart/ and lua/custom/ folders
- Add colors/orng.vim + colors/orng-light.vim stubs for mid-session switching
- init.lua reduced from 1078 lines to 49 lines
2026-02-26 11:54:58 +01:00

51 lines
1.4 KiB
Lua

-- lua/plugins/conform.lua
-- Code formatting via conform.nvim
return {
'stevearc/conform.nvim',
event = { 'BufWritePre' },
cmd = { 'ConformInfo' },
keys = {
{
'<leader>f',
function()
require('conform').format { async = true, lsp_format = 'fallback' }
end,
mode = '',
desc = '[F]ormat buffer',
},
},
opts = {
notify_on_error = false,
format_on_save = function(bufnr)
-- Disable lsp_fallback for languages without a standardized style.
local disable_filetypes = { c = true, cpp = true }
if disable_filetypes[vim.bo[bufnr].filetype] then
return nil
end
return { timeout_ms = 500, lsp_format = 'fallback' }
end,
formatters = {
yamlfmt = {
prepend_args = { '-conf', vim.fn.expand '~/.config/yamlfmt/.yamlfmt' },
},
},
formatters_by_ft = {
lua = { 'stylua' },
python = { 'black' },
javascript = { 'biome', 'prettier', stop_after_first = true },
typescript = { 'biome', 'prettier', stop_after_first = true },
javascriptreact = { 'biome', 'prettier', stop_after_first = true },
typescriptreact = { 'biome', 'prettier', stop_after_first = true },
json = { 'biome', 'prettier', stop_after_first = true },
html = { 'prettier' },
css = { 'prettier' },
graphql = { 'prettier' },
yaml = { 'yamlfmt' },
},
},
}