return { { -- Autoformat 'stevearc/conform.nvim', event = { 'BufWritePre' }, cmd = { 'ConformInfo' }, keys = { { 'f', function() require('conform').format { async = true, lsp_format = 'fallback' } end, mode = '', desc = '[F]ormat buffer', }, }, config = function() local conform = require 'conform' conform.setup { notify_on_error = false, format_on_save = function(bufnr) local disable_filetypes = { c = true, cpp = true, vue = true } if disable_filetypes[vim.bo[bufnr].filetype] then return nil else return { timeout_ms = 500, lsp_format = 'fallback', } end end, formatters_by_ft = { lua = { 'stylua' }, --xml = { 'xmlformatter' }, -- USE CUSTOM FORMATTER python = { 'black', 'isort' }, json = { 'prettierd' }, }, } vim.api.nvim_create_autocmd('BufWritePre', { pattern = '*', callback = function(args) require('conform').format { bufnr = args.buf, lsp_fallback = true } end, }) end, }, }