conform.nvim icon indicating copy to clipboard operation
conform.nvim copied to clipboard

feature request: Inherit from existing formatter

Open ysooqe opened this issue 1 month ago • 0 comments

Did you check existing requests?

  • [x] I have searched the existing issues

Describe the feature

First of all, thanks for the great plugin!

It would be great if a custom formatter could "inherit" from an existing formatter, e.g. using the inherit key and instead of setting it to true or false (extenting or overwriting the formatter with the same name), it would be greate if I could specify an existing formatter to inherit the entire config from so that I could create a formatter that is shared among many filetypes but has a only a few settings changed or added (in my example, an additional argument for the command). This could also be separate from the inherit config and could be called clone or something similiar.

In the end, it would be looking something like this:

formatters = {
  deno_fmt_markdown = {
    clone = 'deno_fmt',
    append_args = { '--indent-width', '4' },  
  },
}

Provide background

I have the following use case:

I am using deno_fmt for different filetypes. The default is an indent-width of 2 (for typescript, javascript, etc.) but for markdown (which it can also format), I would like to set a indent-width of 4 (which can be done with the arg --indent-width).

Unfortunately, I did not manage to find a way to configure the same formatter (slightly) differently for different filetypes.

If my use case of "same formatter for different filetypes with only slightly different options" is already covered by something else, please ignore this feature request. I would appreciate a short hint on how to achieve this though.

What is the significance of this feature?

nice to have

Additional details

No response

ysooqe avatar Nov 03 '25 10:11 ysooqe