woohooo
This commit is contained in:
commit
085347ddac
49 changed files with 1931 additions and 0 deletions
41
lua/plugins/conform.lua
Normal file
41
lua/plugins/conform.lua
Normal file
|
|
@ -0,0 +1,41 @@
|
|||
return {
|
||||
'stevearc/conform.nvim',
|
||||
event = { 'BufWritePre' },
|
||||
cmd = { 'ConformInfo' },
|
||||
keys = {
|
||||
{
|
||||
'<leader>f',
|
||||
function()
|
||||
require('conform').format { async = true, lsp_format = 'fallback' }
|
||||
end,
|
||||
mode = '',
|
||||
desc = '[F]ormat buffer',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
-- Skip special buffers (e.g. CodeCompanion chat, terminals)
|
||||
if vim.bo[bufnr].buftype ~= '' then
|
||||
return nil
|
||||
end
|
||||
local disable_filetypes = {}
|
||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||
return nil
|
||||
end
|
||||
return { timeout_ms = 500, lsp_format = 'fallback' }
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
c = { 'clang-format' },
|
||||
cpp = { 'clang-format' },
|
||||
python = { 'isort', 'black' },
|
||||
go = { 'goimports', 'gofmt' },
|
||||
java = { 'google-java-format' },
|
||||
html = { 'prettier' },
|
||||
css = { 'prettier' },
|
||||
markdown = { 'prettier' },
|
||||
toml = { 'taplo' },
|
||||
},
|
||||
},
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue