How to open a new c++ file with a predefined template in Sublime Text? I am keen to know if there is a way to open not an empty new file but a new file with some predefined template. I participate in online coding contests and for every new file (which I save as a '.cpp'), I have to Cmd+C and Cmd+V all the preprocessor directives i.e. #include &lt;..&gt;'s and #define's from one of my earlier '.cpp' file. Is there a way by which I can have all these things written to some file and every new file that I save as a c++ file this data gets loaded onto it thus saving my copy-pasting/retyping. Eclipse IDE has this feature, I wanted to know if its possible somehow in Sublime Text too. Thanx!
You should use a snippet. For instance, you can define a new snippet and trigger it with !initcpp. Then you open a new file, type !initcpp, hit ⇥ and your are ready to go.
To define a new one go to Tools → New Snippet…
From Sublime Text: Snippets.
Snippets can be stored under any package’s folder, but to keep it simple while you’re learning, you can save them to your Packages/User folder.
Snippets File Format
Snippets typically live in a Sublime Text package. They are simplified XML files with the extension .sublime-snippet.
The structure of a typical snippet is as follows (including the default hints Sublime Text inserts for your convenience):
&lt;snippet&gt;
    &lt;content&gt;&lt;![CDATA[Type your snippet here]]&gt;&lt;/content&gt;
    &lt;!-- Optional: Tab trigger to activate the snippet --&gt;
    &lt;tabTrigger&gt;xyzzy&lt;/tabTrigger&gt;
    &lt;!-- Optional: Scope the tab trigger will be active in --&gt;
    &lt;scope&gt;source.python&lt;/scope&gt;
    &lt;!-- Optional: Description to show in the menu --&gt;
    &lt;description&gt;My Fancy Snippet&lt;/description&gt;
&lt;/snippet&gt;

The snippet element contains all the information Sublime Text needs in order to know what to insert, whether to insert and when. Let’s look at each of these parts in turn.
content
The actual snippet. Snippets can range from simple to fairly complex templates. We’ll look at examples of both later.
Keep the following in mind when writing your own snippets:

If you want to get a literal $, you have to escape it like this: \$.
When writing a snippet that contains indentation, always use tabs. When the snippet is inserted, the tabs will be transformed into spaces if the option translateTabsToSpaces is true.
The content must be included in a &lt;![CDATA[…]]&gt; section. Snippets won’t work if you don’t do this!
The content of your snippet must not contain ]]&gt; because this string of characters will prematurely close the &lt;![CDATA[…]]&gt; section, resulting in an XML error. To work around this pitfall, you can insert an undefined variable into the string like this: ]]$NOT_DEFINED&gt;. This modified string passes through the XML parser without closing the content element’s &lt;![CDATA[…]]&gt; section, but Sublime Text will replace $NOT_DEFINED with an empty string before inserting the snippet into your file. In other words, ]]$NOT_DEFINED&gt; in your snippet file content will be written as ]]&gt; when you trigger the snippet.

tabTrigger
Defines the sequence of keys that must be pressed to insert this snippet. After typing this sequence, the snippet will kick in as soon as you hit the ⇥ key.
A tab trigger is an implicit key binding.
scope
Scope selector determining the context where the snippet will be active. See Scopes for more information.
description
Used when showing the snippet in the Snippets menu. If not present, Sublime Text defaults to the file name of the snippet.
With this information, you can start writing your own snippets as described in the next sections.