Closed mangkoran closed 1 week ago
I tried the following config (I use LazyVim) and it works.
{
"stevearc/conform.nvim",
opts = {
formatters_by_ft = {
htmldjango = { "djlint" },
},
formatters = {
djlint = {
args = function(self, ctx)
local indent = vim.bo[ctx.buf].tabstop or 4
return { "-", "--reformat", "--indent", indent }
end,
},
},
},
},
This looks like it would make a reasonable pull request
Did you check existing requests?
Describe the feature
djlint
could format buffer with indent config based on editorconfig/local buffertabstop
Provide background
I found that
djlint
supports indent config argument. It would be nice if this could be incorporated toconform
config so that it could rundjlint
with config based on local buffertabstop
which is set based on editorconfig.What is the significance of this feature?
nice to have
Additional details
I found a bit similar feature in
markdown-toc
config that could respect local buffertabstop
(although it's just check whether it's space or tab).I would like to try to implement this feature so any guidance/suggestion is welcome.
Additionally, I think this feature could be implemented to all formatters that support indent config like this (however I have no idea what the formatters are).