When you first start using Sublime Text, the way in which projects work may not immediately make sense. What is a project? Wait, I have to save a file? Where do I save the file? I’ll cover the basics below, to get to you started.
So what do I need to know?
You Are Always in a Project
Every time you have something open in SublimeText, you are working in a new project. Until you save the project, there’s no record of your current setup (besides the default option “remember_open_files” which makes the application start up with the last set of open files).
The folders displayed on the program’s left sidebar are contained within the project; this isn’t necessary just a tree list. You can remove or add folders and files from other locations.
Projects Must be Saved, as a File
The configuration for your project is saved as the file type “.sublime-project”. To save, simply:
- Click the “Project” item on the menu (Sublime Text 2)
- Click “Save Project As”
- Choose a folder to save your project in. You may want to save all of these files in a single folder*.
- Name your project. This exact file name will show up when choosing from existing projects, so I’d use something readable.
- Save & Done.
*Where do I save my projects?
You could either save the sublime-project file in the same folder as the project you’re working on, or in one folder that contains all of your project definition files. Or somewhere else entirely. I prefer keeping them in one single folder, since I’d rather have my project directory only contain files that will be uploaded to the server (mirroring its contents), and because I can see and open all projects from one location.
Opening and Working with Previous Projects
You can go to Project->Recent Projects in the Sublime Text window, but an even quicker and more visual way is to use the shortcut that opens the switch project dialog:
- Windows & Linux: Ctrl+Alt+P
- Mac: Command + Ctrl + P
Alternatively, you can browse your computer to find the project file, right click and “Open in Sublime Text”. This will load up your project folder.
Note: If you are Moving Your Project Files (or Renaming the Folder they are in)
In my case, I wanted to rename the folder that stores my project files, but when I did, switching to existing projects no longer worked because Sublime Text 2 was looking in the wrong location. If you also run into this, there is a settings file that you can edit to change the directories in one fell swoop. The file is located here:
- WINDOWS x64:
C:/Users[Username]/AppData/Roaming/Sublime Text 2/Settings/Session.sublime_session
~/Library/Application Support/Sublime Text 2/Settings/Session.sublime_session"
Find the section called
recent_workspaces (should be at the very bottom), and you can edit the paths there.
Similar to editing the program’s user preferences, the project files are saved in the JSON format. This file gives you the option to set exclude patterns for file types and folders within your project. You can also override your user settings. Check out the first two links in the reference section for more info on editing these settings.
A Sidenote on SublimeText as an Alternative to Dreamweaver or Coda
Until SublimeText came along, it seemed like only Macs had the slickest web code editors around. If you’re still using Dreamweaver on Windows, it may be time to ditch that unstable beast. Using projects in SublimeText replaces DW’s Site Manager. If you’re editing hundreds of different sites, then you simply want to load one up from a list. Using the FTP extension, you can map a local folder to a remote folder, and you can edit remote files. If you’re accustomed to DreamWeaver’s Ctrl-Shift-U to upload files, the new shortcut to learn (for the extension) is Ctrl+Alt+U+F.
More Info and Reference: