A ruler on SublimeMerge

132 views Asked by At

On SublimeText we can have a vertical line at 100 character position, adding the following to settings

"rulers":[100],

I would like to have the same on SublimeMerge. Is that possible?

1

There are 1 answers

0
OdatNurd On BEST ANSWER

You can indeed do this in Merge, but the setting needs to go into a different place.

In Sublime Text, the setting in Preferences.sublime-settings are applied to editing views by default (since Text is a text editor first and foremost) and then those settings can be further enhanced in other ways, such as syntax specific settings, project settings, and so on.

Since Merge isn't a Text editor by default, adding the rulers setting to Preferences.sublime-settings doesn't have any effect because there aren't any file views to apply the setting to.

What you can do instead though is use Preferences > Browse Packages in Merge to open up your User package, and then create a file in that location named Commit Message.sublime-settings with contents such as the following:

{
    "syntax": "Packages/Git Formats/Git Commit.sublime-syntax",
    "rulers": [72, 50]
}

Here two settings are applied; the syntax is changed from the default to a syntax from the Git Formats package (which ships with Sublime Text and Sublime Merge) and rulers are applied.

The syntax enhances the syntax highlighting for commit messages by highlighting things like #13 when referencing GitHub issues or @username callouts, etc which can be handy if you use those sorts of things in your commit messages.

This also sets up the rulers setting as well. In this example there are two of them because commit message standards are sometimes defined by wanting the first line of a commit message to be no longer than 50 characters and the remaining lines no longer than 70 or 72, etc.

The order of the rulers matters in as much as the first ruler added (here 72) is where the Edit > Wrap Paragraph command will wrap, so if you want more than one visual ruler you'd set the first one to be where you want the wrap to happen./

This settings file only applies to the edit area for commits that you're making or editing, but it doesn't apply to the display of commit messages for existing commits (such as when browsing the graph). If you would like to apply settings to those (such as adding rulers there as well or changing the syntax) you would do that by creating a Commit Message (Read Only).sublime-settings file instead.