Sublime Forum

Customised formatting (Prettier) just for my editor

#1

Maybe a bit of a strange question, we like many companies use Prettier to format files. Generally that’s ok, but we’ve got a printWidth of 80 which I find way too small for my liking.

I’m wondering if there are any approaches/plugins/hacks that people can think of that would allow me to increase the printWidth just for myself locally, but then would respect the 80 characters elsewhere. Ideas I thought of:

  • Rendering different content to screen than within the file (e.g. running the code though prettier before showing in the editing window)
  • Convert to a different length on disk, but converting back to 80 in a pre-commit hook.

I’m not sure either of those approaches would work, so I thought I’d just throw it out for some ideas.

0 Likes

#2

You would have to dig very deep here. If you transform pre-commit you basically want to transform post-checkout as well. Then all the diffs are wrong so you have to fix that too. I think of it as the auto.crlf setting on steroids. But the crlf/whitespace stuff is everywhere in git. Maybe in a one year sabbatical?

1 Like

#3

Thanks @herr.kaste, that’s pretty big (and I know you know Sublime well as I use a few of your packages) so I might have to live with premature wrapping.

Thanks for the response though, appreciate it!

0 Likes

#4

That’s a shame. I’ve always hated how tiny 80 columns are, we’re not in 2010 anymore!

0 Likes

#5

I agree, the first option should always be to talk with your team and see if limits can be increased. Unfortunately I was in the minority wanting longer line lengths so I’ll just have to learn to live with it.

0 Likes