elentok / format-on-save.nvim

Automatically formats files when saving using either LSP or shell utilities like prettierd or shfmt
MIT License
159 stars 5 forks source link

Formatting very extreme! #14

Open FormalSnake opened 1 year ago

FormalSnake commented 1 year ago

Using null-ls I could configure the width like this: args = { "--stdin-filepath", "$FILENAME", "--print-width", "80", "--tab-width", "2" }, But with this plugin I get extreme spacing, mostly 3 tabs per indentation.

faergeek commented 1 year ago

Not sure what formatter you are talking about, but in general you can construct the command however you want with something like this:

formatters.shell({ cmd = { "myformatter", "--stdin-filepath", "%", "--print-width", "80", "--tab-width", "2" } })

There are some examples in readme.

FormalSnake commented 1 year ago

prettierd

faergeek commented 1 year ago

Does my comment above solve your problem then? formatters.prettierd is internally defined like this formatters.shell({ cmd = { "prettierd", "%" } }). So you can just copy this snippet and add as many arguments as you like.

FormalSnake commented 1 year ago

I will try it in a second

elentok commented 11 months ago

Thanks @faergeek

Hi @FormalSnake, did you happen to try @faergeek's suggestion?

FormalSnake commented 11 months ago

I did, but it recently broke.