Search Icon, Magnifying Glass

Marmanold.com

Graduation CapHeartQuestion MarkMagnifying Glass

Sublime Notes Template Snippet

Mon, May 29, 2017

Several months ago I followed the lead of my friend Jon Boulineau and switched from Evernote/Simplenote/OneNote for my note taking needs, to Sublime Text using the Sublime Note package.

Sublime Text uses significantly less system resources than the alternatives and is incredibly stable at all times. Further, when synched via Dropbox, all of my super-small, plain-text note files are instantly available on all of my devices — mobile and otherwise.

The Sublime Notes package gives one syntax highlighting and about everything one might need, except for a default note template. Creating this in Sublime Text 3 is a very easy operation.

1. Create a New Snippet

In the menu bar select Tools->Developer->New Snippet.... This will open a new snippet template in your active Sublime Text window.

2. Modify the Snippet

I wanted a template with a box title at the top, a space for the current date, and a space for custom tags. (I use ~ to denote tags to make it easier to search using Alfred/Spotlight.) I also wanted to be able to quickly tab between sections in my template so my hands didn’t need to leave the keyboard.

The below snippet does all of the above and auto inserts the notes template into any blank document when note is typed followed by the tab key.

<snippet>
	<content><![CDATA[
-----------------------------------------------------------
    ${1:title}
-----------------------------------------------------------

Date: $2
Tags: $3

$4
]]></content>
	<tabTrigger>note</tabTrigger>
	<scope>text.plain,source.notes</scope>
</snippet>

3. Save the Snippet

Sublime Text 3 should have the snippet already set to save in the correct location. However, if it doesn’t for whatever reason the path is: Users/username/Library/Application Support/Sublime Text 3/Packages/User/notes.sublime-snippet Save your snippet there, quit and relaunch Sublime Text, and you should be off to the races.