Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

sublimetext2

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?

like image 761
ValeriiVasin Avatar asked Jun 07 '13 11:06

ValeriiVasin


2 Answers

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

like image 193
Daniel Lutz Avatar answered Oct 21 '22 15:10

Daniel Lutz


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.

like image 36
Anto Avatar answered Oct 21 '22 16:10

Anto