first commit
This commit is contained in:
37
profiles/desktop/.config/nvim/lua/plugins/conform.lua
Normal file
37
profiles/desktop/.config/nvim/lua/plugins/conform.lua
Normal file
@@ -0,0 +1,37 @@
|
||||
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,
|
||||
}
|
||||
Reference in New Issue
Block a user