Jon Lee

website guide

Using Sublime Text

Project window

The project window has a sidebar which shows all of the files under the project directory. The main area of the window is the text editor.

To open a new project window, see the instructions for starting an editing session.

Editing files

Select a file from the sidebar to open it, and begin editing the file in the text editor. Once you are satisfied with your changes, save the file by going to File > Save, or using the shortcut Command-S.

Pro tip: if you prefer keyboard shortcuts to using the cursor, you can also select a file by bringing up a file panel with Command-P. You can then immediately type in the filename you’re looking for. The panel immediately updates to list the files that match what you typed. You don’t even need to remember the name character-by-character. For example, to look for “index.md” you can start typing i-n-d, or even, i-x, since the “x” in “index” comes after the “i”.

In the screenshot I just added the text “Added some new text.”, and you’ll notice in the tab bar at the top of the editor there is a solid dot on the right of the tab labeled “index.md”. That solid dot means you’ve made changes in the editor, but they are not saved. In order for you see those changes in your local server, you need to save them.

Once I’ve saved, that dot turns into an “✕”.

Then, if I have the local server running, I can point my web browser to that page. Usually my browser is already on the page I’m looking at, so I refresh the browser. Depending on the complexity of the site, regeneration of it which includes the change I just made could take a moment. Looking at the Terminal window I can see how long a change took.

Regenerating: 1 file(s) changed at 2024-01-10 23:50:49
              index.md
 Jekyll Feed: Generating feed for posts
              ...done in 0.989701 seconds.

Useful keyboard shortcuts

If you like to use keyboard shortcuts, here are some useful ones. All of this and more are thoroughly documented on Sublime Text’s website.

Command-S Save file
Command-Shift-S Save all changed files in the window
Command-P or Command-T Search for file (press Enter to open)
Command-F Find text in current file
Command-Shift-F Find text in all files in project
Command-Z Undo last edit
Command-Y Redo last undo, or repeat

The following commands are to move the cursor. If you add the Shift key it selects the text also.

Ctrl-A or Command-← Go to beginning of line
Ctrl-E or Command-→ Go to end of line

Other interesting selection shortcuts:

Ctrl-Shift-← (or →) Select the previous (or next) word
Command-L Expand selection to include the entire line

With Sublime Text you can have multiple cursors and selections. This is useful if you want to replace all instances of a word with another word.

Ctrl-Shift-↑ (or ↓) Column selection: add a cursor to the previous (or next) line (Command-U to undo)
Ctrl-Command-G Select all instances of the word the cursor is on, or the selected text, in the file
Command-Shift-L Take a selection of multiple lines, and add cursors to the end of each line
Command-D Add to selection the next instance of the selected text (Command-U to undo)
Command-K, Command-D Skip the next instance of the selected text
Esc Go back to single selection from multiple selection

Hi! Have a comment, question, complaint, observation, or criticism about this post? Leave your comment below!