So you keep hearing that Sublime Text is the best editor ever? Well you're not wrong. This guide will help you get Sublime Text setup so that you can be busting out cookbooks left and right!
- Steps
- Install Sublime Text 3
- Configure your User Settings
- Set up Symlink
- Add Folders to Project
- Additional Customization
- Install Package Control
- Install Soda Theme
- Add Bonus Syntax Highlighing Colour Schemes
- Update your User Settings
Go to Sublime's website and select the OS X download
- Even though Sublime Text 3 is technically still in Beta, the Beta is stable
- Open Sublime Text
- Open user settings
- Preferences -> Settings
- Using hotkey:
Command + ,
-
Paste the following into the USER settings:
{ "auto_complete_commit_on_tab": true, "auto_complete_delay": 1000, "close_windows_when_empty": true, "ensure_newline_at_eof_on_save": true, "font_size": 13, "ignored_packages": [ "Vintage" ], "scroll_past_end": true, "tab_size": 2, "translate_tabs_to_spaces": true, "trim_automatic_white_space": false, "trim_trailing_white_space_on_save": true, "word_wrap": "enabled" }
-
Save the file
We create this symlink so that you can easily open files on your workstation in Sublime Text
ln -s "/Applications/Sublime Text.app/Contents/SharedSupport/bin/subl" /usr/local/bin/subl
A way to test this is to run subl testfile.md
on your local machine. It should open the file in Sublime Text. You can then write whatever you want and save the file. Much easier than vim
!
One of the best parts about Sublime Text is that you can add folders as a project. What this means is that you can take a copy of a cookbook that you have forked to your local machine and edit it within Sublime! Here is an example of how to do this:
-
Create a directory for your cookbooks
mkdir ~/cookbooks cd ~/cookbooks
-
Clone something from your personal GitHub repository.
-
In this case we use cerner_tomcat which I already have forked to my personal repo
git clone https://github.com/$USER/cerner_tomcat.git
- Open Sublime Text
- Project -> Add Folder to Project
- Navigate to the directory above your
~/cookbooks
folder and drag and drop the entire~/cookbooks
folder onto Sublime
You should now see your cookbooks folder on your left-hand toolbar and within it, ets_base_os. You can navigate with that toolbar to open files and make edits. Any edits that you make will be reflected on the actual files after you save them in Sublime. Since you added the entire ~/cookbooks
directory, any new cookbooks you add will automatically show up in Sublime!
Everything from here on out is optional but I think it results in a nice setup for cookbook development. I personally use the Soda Theme but you can swap it out for any other theme.
Package Control makes it easy to install/remove/upgrade Sublime Text packages
- Go to Package Control's website
- Copy the Python code to your clipboard
- Open Sublime Text
- Open the Sublime Text console by pressing `ctrl+``
- Paste the Python code from your clipboard into the console and then press
Enter
- Restart Sublime Text
- Open the Command Palette
- Tools -> Command Palette
- Using hotkey:
Command + Shift + P
- Type in
Package Control: Install Package
- Press
Enter
- Type in
Theme - Soda
- Press
Enter
- Restart Sublime Text
- Navigate to the Soda Theme GitHub page and download the additional color schemes listed in the README
- Or just click here: colour-schemes.zip
-
Copy the themes to the Packages User directory
cp /Users/$USER/Downloads/colour-schemes/* "/Users/$USER/Library/Application Support/Sublime Text 3/Packages/User"
- Open Sublime Text
- Open user settings
- Preferences -> Settings - User
- Using hotkey:
Command + ,
-
Paste the following:
{ "auto_complete_commit_on_tab": true, "auto_complete_delay": 1000, "close_windows_when_empty": true, "color_scheme": "Packages/User/Monokai Soda.tmTheme", "ensure_newline_at_eof_on_save": true, "font_size": 13, "ignored_packages": [ "Vintage" ], "line_padding_bottom": 0.5, "line_padding_top": 0.5, "rulers": [ 80, 100 ], "scroll_past_end": true, "soda_classic_tabs": true, "soda_folder_icons": true, "tab_size": 2, "theme": "Soda Light 3.sublime-theme", "translate_tabs_to_spaces": true, "trim_automatic_white_space": false, "trim_trailing_white_space_on_save": true, "word_wrap": "enabled" }
-
Save the file
These updated settings do a couple things:
- Pulls in the Soda Theme and updated colour schemes
- Uses the classic tabs instead of the Soda tabs
- Changes the folder icons to be folders
- Adds an 80 and 100 character ruler for Ruby best practices