This commit is contained in:
sankalp committed 2024-08-26 10:11:28 +05:45
1 parent 847238c1bc
commit 35a8122396
13 files changed
+363 -146

No files matched your search

+22 -3
View File
@@ -1,10 +1,27 @@
-- Define conform.nvim formatting servers here
local formatting_servers = {
'prettier',
'isort',
'clang-format',
'black',
'stylua',
'shfmt',
'php-cs-fixer',
'google-java-formatter',
'codespell',
}
return {
'stevearc/conform.nvim',
enabled = true,
dependencies = { 'zapling/mason-conform.nvim' },
event = { 'BufReadPre', 'BufNewFile' },
cmd = { 'ConformInfo' },
config = function()
local conform = require('conform')
require('mason-conform').setup({
ensure_installed = formatting_servers,
automatic_installation = true,
})
conform.setup({
formatters_by_ft = {
cpp = { 'clang-format' },
@@ -17,7 +34,7 @@ return {
html = { 'prettier' },
json = { 'prettier' },
yaml = { 'prettier' },
markdown = { 'prettier' },
markdown = { 'prettier', 'markdownlint' },
lua = { 'stylua' },
python = { 'isort', 'black' },
php = { 'php-cs-fixer' },
@@ -26,6 +43,8 @@ return {
liquid = { 'prettier' },
bash = { 'shfmt' },
sh = { 'shfmt' },
['*'] = { 'codespell' },
['_'] = { 'trim_whitespace' },
},
format_on_save = function(bufnr)
-- Disable with a global or buffer-local variable