How to turn removing whitespaces off for some files in Sublime Text 2?

放肆的年华 提交于 2019-12-21 04:53:13

问题


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?


回答1:


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




回答2:


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.



来源:https://stackoverflow.com/questions/16983328/how-to-turn-removing-whitespaces-off-for-some-files-in-sublime-text-2

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!