How to turn removing whitespaces off for some file

2019-03-29 10:48发布

I have an option trim_trailing_white_space_on_save turned on. And for some files I should prevent removing trailing white spaces, because they are important.

How to remove this behaviour for some files, e.g. *.dat?

2条回答
神经病院院长
2楼-- · 2019-03-29 11:20

In Sublime 3, just open any file with the extension you'd like to have specific settings for, and go to Preferences > Settings - Syntax Specific.

In my case I did it for Markdown (.md) and Sublime created a Markdown.sublime-settings file in which I added the following:

"trim_trailing_white_space_on_save": false,

In your case, for a .dat file, Sublime will create a Plain text.sulbime-settings file in which you can add the exact same setting.

查看更多
一夜七次
3楼-- · 2019-03-29 11:21

Have you already tried to create a configuration file for that specific extension and put trim_trailing_white_space_on_save = false ?

Settings Files

Settings files are consulted in this order:

  1. Packages/Default/Preferences.sublime-settings
  2. Packages/Default/Preferences (< platform >).sublime-settings
  3. Packages/User/Preferences.sublime-settings
  4. < Project Settings >
  5. Packages/< syntax >/< syntax >.sublime-settings
  6. Packages/User/.sublime-settings
  7. < Buffer Specific Settings >

In general, you should place your settings in Packages/User/Preferences.sublime-settings.

If you want to specify settings for a certain file type, for example, Python, you should place them in Packages/User/Python.sublime-settings.

http://www.sublimetext.com/docs/2/settings.html

查看更多
登录 后发表回答