As you can see from the screengrab above, there are loads of useful commands included with the Sublime-Jekyll package. However I’ve been finding that some commands definately are more useful than others! The four commands I find I’m calling 95% of the time are:

1. Create a new draft from template
2. Promote a draft to a post
3. Create a new template
4. Edit a template

Each time I go to call one of the commands from the command-palette in Sublime it takes a couple of seconds to call up the command-palette (⇧⌘P), type the correct keystrokes and navigate through the few matching commands returned to get to the command I want. To speed things up I added these keybindings to my User Keybindings file1:

// JEKYLL KEYBINDINGS
{ "keys": ["ctrl+j", "ctrl+d"], "command": "jekyll_new_draft_from_template" },
{ "keys": ["ctrl+j", "ctrl+p"], "command": "jekyll_promote_draft" },
{ "keys": ["ctrl+j", "ctrl+t"], "command": "jekyll_new_template" },
{ "keys": ["ctrl+j", "ctrl+e"], "command": "jekyll_edit_template" }


You can probably see the logic of using these bindings, ctrl-j (J for Jekyll) followed by the letter indicating the command you want; draft, promote, template, edit.

Aside from the commands included in Sublime-Jekyll I also want to serve my Jekyll site on my local machine to check how draft blog posts look. I would also like to be able to build and deploy my Jekyll sites from within Sublime. For this I need two custom sublime-builds and I’ve found the best place to put these is in my project-settings files. Here’s an example build_systems block from one of those files:

"build_systems":
[
// This will build your Jekyll site, and print a traces to the console
{
"name": "Jekyll Build",
"working_dir": "$project_path", "cmd": "<add your own commands here>", "shell": true, "encoding": "UTF-8", }, { "name": "Jekyll Serve", "working_dir": "$project_path",
"cmd": ["bundle exec jekyll build --drafts --config _config.yml,_config_dev.yml; open http://localhost:84/"],
"shell": true,
"encoding": "UTF-8",
"env":
{
"PATH": "/usr/bin:/Users/Dave/anaconda/envs/jekyll/bin"
}
}
],


And to add the final cherry I can also create key bindings to quickly triggers these builds:

{ "keys": ["ctrl+j", "ctrl+s"], "command": "build", "args": { "build_system": "Jekyll Serve"}},
{ "keys": ["ctrl+j", "ctrl+b"], "command": "build", "args": { "build_system": "Jekyll Build"}}


The neat thing about adding the builds to the project settings files instead of a dedicated .sublime-build file is that I can customise the serve/build commands for different Jekyll sites but still trigger them with the same key bindings as long as they are given the same build names.

1. open the keybindings files via the command–paelette or via the menu Sublime-Text > Preferences > Key Bindings  ↩