Feat: support format on save
- use conform to format file
This commit is contained in:
parent
6e9cf88b96
commit
71e9c28bf7
|
@ -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,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
Loading…
Reference in New Issue