This commit is contained in:
Christoph J. Scherr 2023-10-01 19:23:30 +02:00
parent 3004b5f61b
commit 479b600626
3 changed files with 28 additions and 3 deletions

View File

@ -33,9 +33,23 @@ return {
} }
end, end,
}, },
-- NOTE: If using this config, you need to install prettierd.
-- At the time of writing that is done with:
-- `sudo npm install -g @fsouza/prettierd`
cpp = { require("formatter.filetypes.cpp").clangformat }, cpp = { require("formatter.filetypes.cpp").clangformat },
css = { require("formatter.filetypes.css").prettierd }, css = { require("formatter.filetypes.css").prettierd },
html = { require("formatter.filetypes.html").prettierd }, -- NOTE: If you don't care about django templates,
-- you can use one of the formatters provided by default.
-- html = { require("formatter.filetypes.html").prettierd },
html = {
function()
return {
exe = "djlint",
args = { "-" },
stdin = 1,
}
end,
},
java = { require("formatter.filetypes.java").clangformat() }, java = { require("formatter.filetypes.java").clangformat() },
javascript = { require("formatter.filetypes.javascript").prettierd }, javascript = { require("formatter.filetypes.javascript").prettierd },
json = { require("formatter.filetypes.json").prettierd }, json = { require("formatter.filetypes.json").prettierd },
@ -43,7 +57,15 @@ return {
latex = { require("formatter.filetypes.latex").latexindent }, latex = { require("formatter.filetypes.latex").latexindent },
markdown = { require("formatter.filetypes.markdown").prettierd }, markdown = { require("formatter.filetypes.markdown").prettierd },
php = { require("formatter.filetypes.php").phpcbf }, php = { require("formatter.filetypes.php").phpcbf },
python = { require("formatter.filetypes.python").autopep8() }, python = {
function()
return {
exe = "autopep8",
args = { "--aggressive -" },
stdin = 1,
}
end,
},
sh = { require("formatter.filetypes.sh").shfmt() }, sh = { require("formatter.filetypes.sh").shfmt() },
sql = { require("formatter.filetypes.sql").pgformat() }, sql = { require("formatter.filetypes.sql").pgformat() },
toml = { require("formatter.filetypes.toml").taplo() }, toml = { require("formatter.filetypes.toml").taplo() },
@ -54,7 +76,7 @@ return {
-- "formatter.filetypes.any" defines default configurations for any -- "formatter.filetypes.any" defines default configurations for any
-- filetype -- filetype
require("formatter.filetypes.any").remove_trailing_whitespace, require("formatter.filetypes.any").remove_trailing_whitespace,
require("formatter.defaults.prettierd") require("formatter.defaults.prettierd"),
}, },
} }
opts.filetype = vim.tbl_extend("keep", opts.filetype or {}, filetypes) opts.filetype = vim.tbl_extend("keep", opts.filetype or {}, filetypes)

View File

@ -200,3 +200,6 @@ pyi
bietete bietete
desc desc
Scherr Scherr
mariadb
Gawa
Django

Binary file not shown.