stevearc / conform.nvim

Lightweight yet powerful formatter plugin for Neovim
MIT License
3.1k stars 163 forks source link

Is there a way to only format manually (never format on save)? #337

Closed avahe-kellenberger closed 7 months ago

avahe-kellenberger commented 7 months ago

Did you check existing requests?

Describe the feature

I want to format when I press a key binding, not when I save the buffer. Is there a way to do this, a config option maybe?

I'm currently using kickstart with lazy.nvim, this is my conform config:

{ -- Autoformat
    'stevearc/conform.nvim',
    opts = {
      notify_on_error = false,
      format_on_save = {
        timeout_ms = 500,
        lsp_fallback = true,
      },
      formatters_by_ft = {
        lua = { 'stylua' },
        -- Conform can also run multiple formatters sequentially
        -- python = { "isort", "black" },
        --
        -- You can use a sub-list to tell conform to run *until* a formatter
        -- is found.
        javascript = { { 'prettierd', 'prettier' } }
      }
    }
  }

I've tried fiddling with the config, deleting the whole format_on_save block, etc. but it seems to always autoformat on save.

Provide background

No response

What is the significance of this feature?

strongly desired

Additional details

No response

avahe-kellenberger commented 7 months ago

Disregard, it was some nonsense with zig autoformatting on save for some reason. Had to set let g:zig_fmt_autosave = 0 for anyone else running into this problem