conform
This commit is contained in:
parent
77c38f1eb1
commit
d130d5241b
30
init.lua
30
init.lua
|
|
@ -773,7 +773,7 @@ require('lazy').setup({
|
||||||
cmd = { 'ConformInfo' },
|
cmd = { 'ConformInfo' },
|
||||||
keys = {
|
keys = {
|
||||||
{
|
{
|
||||||
'<leader>f',
|
'<leader>ff',
|
||||||
function() require('conform').format { async = true, lsp_format = 'fallback' } end,
|
function() require('conform').format { async = true, lsp_format = 'fallback' } end,
|
||||||
mode = '',
|
mode = '',
|
||||||
desc = '[F]ormat buffer',
|
desc = '[F]ormat buffer',
|
||||||
|
|
@ -783,15 +783,16 @@ require('lazy').setup({
|
||||||
---@type conform.setupOpts
|
---@type conform.setupOpts
|
||||||
opts = {
|
opts = {
|
||||||
notify_on_error = false,
|
notify_on_error = false,
|
||||||
format_on_save = function(bufnr)
|
format_after_save = function(bufnr)
|
||||||
-- Disable "format_on_save lsp_fallback" for languages that don't
|
-- Disable "format_on_save lsp_fallback" for languages that don't
|
||||||
-- have a well standardized coding style. You can add additional
|
-- have a well standardized coding style. You can add additional
|
||||||
-- languages here or re-enable it for the disabled ones.
|
-- languages here or re-enable it for the disabled ones.
|
||||||
local disable_filetypes = { c = true, cpp = true }
|
local disable_filetypes = {}
|
||||||
if disable_filetypes[vim.bo[bufnr].filetype] then
|
if disable_filetypes[vim.bo[bufnr].filetype] then
|
||||||
return nil
|
return nil
|
||||||
else
|
else
|
||||||
return {
|
return {
|
||||||
|
async = true,
|
||||||
timeout_ms = 500,
|
timeout_ms = 500,
|
||||||
lsp_format = 'fallback',
|
lsp_format = 'fallback',
|
||||||
}
|
}
|
||||||
|
|
@ -804,6 +805,29 @@ require('lazy').setup({
|
||||||
--
|
--
|
||||||
-- You can use 'stop_after_first' to run the first available formatter from the list
|
-- You can use 'stop_after_first' to run the first available formatter from the list
|
||||||
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
-- javascript = { "prettierd", "prettier", stop_after_first = true },
|
||||||
|
javascript = { 'prettierd' },
|
||||||
|
typescript = { 'prettierd' },
|
||||||
|
javascriptreact = { 'prettierd' },
|
||||||
|
typescriptreact = { 'prettierd' },
|
||||||
|
scss = { 'prettierd' },
|
||||||
|
pandoc = { 'prettierd' },
|
||||||
|
markdown = { 'prettierd' },
|
||||||
|
json = { 'prettierd' },
|
||||||
|
css = { 'prettierd' },
|
||||||
|
yml = { 'prettierd' },
|
||||||
|
html = { 'prettierd' },
|
||||||
|
php = { 'pretty-php' },
|
||||||
|
cpp = { 'clang_format' },
|
||||||
|
sh = { 'shfmt' },
|
||||||
|
go = { 'gofumpt' },
|
||||||
|
python = {
|
||||||
|
-- To fix auto-fixable lint errors
|
||||||
|
'ruff_fix',
|
||||||
|
-- To run the Ruff formatter
|
||||||
|
'ruff_format',
|
||||||
|
-- To organize the imports
|
||||||
|
'ruff_organize_imports',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue