Reputation: 190
I'm opening .RUL files in Sublime Text which do not have any syntax highlighting, since InstallScript has a similar syntax to C/C++ I want all my .rul files to be treated as if they were .c or .cpp files and automatically have all the same highlighting applied to them. In other words: I want to have the same effect as if I renamed each .rul file to .cpp and then opened the .cpp in Sublime.
What's the easiest way to implement this in Sublime Text 2.0.2 ?
Upvotes: 1
Views: 1763
Reputation: 190
I'm not sure if the other solutions posted above will apply to all future instances of *.rul files, OR only to the currently open file.
I found a solution that works perfectly fine for me, just edit: ...\Application Data\Sublime Text 2\Packages\C++\C.tmLanguage
<key>fileTypes</key>
<array>
<string>c</string>
<string>h</string>
<string>rul</string>
According to: http://docs.sublimetext.info/en/sublime-text-2/reference/syntaxdefs.html
fileTypes
This is a list of file extensions (without the leading dot). When opening files of these types, Sublime Text will automatically activate this syntax definition for them. Optional.
Upvotes: 1
Reputation: 13457
/Users/HOME/Library/Application Support/Sublime Text 2/Packages/C++/C++.sublime-settings
{
"extensions": ["cpp", "cc", "cxx", "c++", "h", "hpp", "hxx", "h++", "inl", "ipp", "rul"]
}
Or, create a similar file and place it in your User
directory, for rul
and any other additional extensions not defined in the file mentioned hereinabove:
/Users/HOME/Library/Application Support/Sublime Text 2/Packages/User/C++.sublime-settings
{
"extensions": ["rul"]
}
Upvotes: 0
Reputation: 1693
You can open the file in Sublime Text and use menu "View" → "Syntax" → "Open all with current extension as..." → (select appropriate syntax).
Also, you can click on right bottom corner of the window. This will open similar menu, where "Open all with current extension as..." is presented too.
Upvotes: 3
Reputation: 14939
Press Ctrl+Shift+P and type C++
, highlight Set Syntax: C++
and press Enter.
Or go to View
menu > Syntax
> Click C++
.
Upvotes: 0