Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Different rulers by file type in Sublime Text 2

Tags:

Is there a way to tell sublime text 2 to display a column 78 ruler in python and javascript and no ruler in HTML, by default?

like image 749
Matthew James Davis Avatar asked May 21 '13 15:05

Matthew James Davis


People also ask

How do I change a file in sublime?

You can manually change file type editing preferences using the SUBLIME-OPTIONS file. There is a User File Type. sublime-options file and a Default File Type. sublime-options file, which are both located in the Packages/​Default directory.


2 Answers

Yes! For both a Python and a Javascript file, open it (or just set the syntax for an empty file to Python or Javascript), then click Preferences -> Settings – More -> Syntax Specific – User. Edit that settings file like you would your regular user settings file. Once you're finished, it will look something like this:

{
    "rulers": [
        78
    ]
} 

Do the same for HTML, but make the "rulers" array empty, i.e.:

{
    "rulers": [ ]
} 

Subsequently, Javascript and Python files will have a ruler at line 78, whereas HTML will display no rulers. Any settings that you can define in your user settings file can be made specific to a syntax.

like image 131
angerson Avatar answered Oct 30 '22 12:10

angerson


Close the file and re-open it if it doesn't take effect. Had to do this with my .py files. Applies for Sublime 3

like image 25
stonefury Avatar answered Oct 30 '22 12:10

stonefury