diff --git a/lua/custom/plugins/conform.lua b/lua/custom/plugins/conform.lua new file mode 100644 index 00000000..0e643ce6 --- /dev/null +++ b/lua/custom/plugins/conform.lua @@ -0,0 +1,20 @@ +return { + 'stevearc/conform.nvim', + event = { 'BufReadPre', 'BufNewFile' }, + opts = { + formatters_by_ft = { + lua = { 'stylua' }, + python = function(bufnr) + if require('conform').get_formatter_info('ruff_format', bufnr).available then + return { 'ruff_format' } + else + return { 'isort', 'black' } + end + end, + }, + format_on_save = { + timeout_ms = 500, + lsp_fallback = true, + }, + }, +}