- 
                Notifications
    
You must be signed in to change notification settings  - Fork 247
 
Closed
Description
LazyVim uses conform.nvim for formatting.
To make configuration easier, we added some extra options to conform.nvim:
opts.format: default options used byrequire("conform").format()opts.formatters: instead of just adding new formatters, you can also override the default options for any formatteropts.formatters[NAME].extra_args: extra arguments passed to the formatter command.
If you want to fully override theargs, just useargsinstead ofextra_args.
This all works as expected in LazyVim, but I believe these changes would benefit others as well.
Ideally, I also prefer not to deviate from a plugin's options.
Would you be open to accept a PR for this? If so I can create one.
Example
{
  -- LazyVim will use these options when formatting with the conform.nvim formatter
  format = {
    timeout_ms = 1000,
  },
  formatters_by_ft = {
    lua = { "stylua" },
    fish = { "fish_indent" },
    sh = { "shfmt" },
  },
  -- LazyVim will merge the options you set here with builtin formatters.
  -- You can also define any custom formatters here.
  ---@type table<string,table>
  formatters = {
    injected = { options = { ignore_errors = true } },
    -- # Example of using dprint only when a dprint.json file is present
    dprint = {
      condition = function(ctx)
        return vim.fs.find({ "dprint.json" }, { path = ctx.filename, upward = true })[1]
      end,
    },
    --
    -- Example of using shfmt with extra args
    shfmt = {
      extra_args = { "-i", "2", "-ci" },
    },
  },
}dadav and xfzvAucaCoyan
Metadata
Metadata
Assignees
Labels
No labels