return { 'stevearc/conform.nvim', event = { 'BufWritePre' }, cmd = { 'ConformInfo' }, keys = { { '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) -- C/C++ have no single house style, so format those by hand with f. local manual_only = { c = true, cpp = true } if manual_only[vim.bo[bufnr].filetype] then return nil end return { timeout_ms = 500, lsp_format = 'fallback' } end, -- A formatter that is not installed is skipped, and lsp_format = 'fallback' takes over. -- Java has no entry on purpose: jdtls formats it (see lua/servers/jdtls.lua). formatters_by_ft = { lua = { 'stylua' }, c = { 'clang-format' }, cpp = { 'clang-format' }, python = { 'ruff_organize_imports', 'ruff_format' }, sh = { 'shfmt' }, verilog = { 'verible' }, systemverilog = { 'verible' }, }, formatters = { ['clang-format'] = { prepend_args = { '--style=file', '--fallback-style=Google' } }, }, }, }