11

I have a project I started with Sublime and/or WebStorm, and now I want to switch to Atom.

The problem is whenever I save, the whole file gets reformatted and that is a big mess for git, which shows mostly all lines being modified.

I want to disable auto-format on save. Is that possible?

4 Answers 4

14

If you have the atom-beautify package installed, you can enable/disable auto-format on save for each supported language separately:

PreferencesPackagesatom-beautify → scroll waaay down to Language Config - LangXYZ - Beautify On Save (with LangXYZ being the language configured).


If you don't have extra packages installed, it might the whitespace package, which comes with Atom and is enabled by default: PreferencesPackageswhitespace

You can either click Disable and be done with it (I did :-)), or you can disable the package selectively via entries in your config.cson file, as documented on the package page itself.

4

"By default, JSFormat's Format on save is set to true."

If you install the JSFormat, you can disable or remove it.

With Atom v1.6.1, I remove JSFormat, and it won't auto format when saving JavaScript files.

2

By default, Atom cleans up the whitespaces when you save a file.

To prevent this default behavior, you have to follow these steps:

  • Go to Preferences ... (Command + ',' in macOS)
  • Click on Open Config Folder
  • Open config.cson
  • Append the following lines to the bottom of it:

whitespace: removeTrailingWhitespace: false

1
  1. CTRL+SHIFT+P
  2. Type "Application Open your Config" , hit enter
  3. Paste

"whitespace": removeTrailingWhitespace: false

enter image description here

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .