Atom text editor remove trailing whitespace on sav

2019-01-21 17:59发布

I use Sublime text. Now I am trying Atom. When I save any file in sublime text it does not include any trailing blank line. But saving any file in Atom leaves a trailing blank line. How do I force Atom not to leave trailing white spaces?

3条回答
相关推荐>>
2楼-- · 2019-01-21 18:42

Go to packages and find "whitespace", go to it's settings and uncheck the last checkbox.

Settings Settings screenshot

Checkbox Checkbox screenshot

查看更多
Juvenile、少年°
3楼-- · 2019-01-21 18:46

On global level this can be changed using settings in Whitespace package, but if you want to disable it for a specific language you have to use syntax-scoped properties in your config.cson.

'.text.html.php': # php overrides
  whitespace:
    ensureSingleTrailingNewline: false
    removeTrailingWhitespace: false

'.source.ruby': # ruby overrides
  whitespace:
    ensureSingleTrailingNewline: false
    removeTrailingWhitespace: false

To see the scope of language go to Packages tab and search for your language.

Click on the settings of the language package and you can see the scope:

查看更多
疯言疯语
4楼-- · 2019-01-21 18:56

Under your Atom Preferences go to Packages tab and search for whitespace. Click on the whitespace package and uncheck Ensure Single Trailing Newline option

enter image description here

查看更多
登录 后发表回答