Files
.dotfiles/.config/nvim/lua/plugin/conform.lua

24 lines
764 B
Lua

MiniDeps.add({ source = 'https://github.com/stevearc/conform.nvim' })
require('conform').setup({
notify_on_error = true,
formatters_by_ft = {
c = { 'clang-format' },
h = { 'clang-format' },
cpp = { 'clang-format' },
hpp = { 'clang-format' },
glsl = { 'clang-format', lsp_format = "first" },
typescript = { 'clang-format', lsp_format = "first" },
css = { 'clang-format' },
rust = { 'rustfmt' },
sh = { 'shfmt' },
python = { 'isort' },
-- json = { 'jq' },
-- yaml = { 'yq' },
toml = { 'yq' },
xml = { 'yq' },
},
})
Map('n', '<leader>f', function()
require('conform').format({ async = true, lsp_format = 'fallback' })
end, { desc = 'Format Buffer' })