38 lines
955 B
Lua
38 lines
955 B
Lua
return {
|
|
'stevearc/conform.nvim',
|
|
event = { 'BufReadPre', 'BufNewFile' },
|
|
config = function()
|
|
local conform = require('conform')
|
|
|
|
conform.setup({
|
|
formatters_by_ft = {
|
|
lua = { 'stylua' },
|
|
cpp = { 'clang-format' },
|
|
c = { 'clang-format' },
|
|
html = { 'prettier' },
|
|
css = { 'prettier' },
|
|
javascript = { 'prettier' },
|
|
python = { 'autopep8', 'isort' },
|
|
bash = { 'beautysh' },
|
|
csh = { 'beautysh' },
|
|
ksh = { 'beautysh' },
|
|
sh = { 'beautysh' },
|
|
zsh = { 'beautysh' },
|
|
},
|
|
-- format_on_save = {
|
|
-- lsp_fallback = true,
|
|
-- async = false,
|
|
-- timeout_ms = 1000,
|
|
-- },
|
|
})
|
|
|
|
vim.keymap.set({ 'n', 'v' }, '<leader>cf', function()
|
|
conform.format({
|
|
lsp_fallback = true,
|
|
async = false,
|
|
timeout_ms = 1000,
|
|
})
|
|
end, { desc = 'Format file or range (in visual mode)' })
|
|
end,
|
|
}
|