Sublime Text Projects

In Sublime Text you can set up a “project” that has more than one folder and more than one file attached to it. This gives your several advantages. For one, you can do a search and replace across all of the files inside all of the folders all at one time.

Suppose you need to replace some text in several files at one time and these files are in several different folders across your hard drive. How do you do this in Sublime Text? First, I will discuss how to create a project if you don’t already have one.

Create a Project

First, you need to open a folder. You can choose Open Folder… from the File menu. On the left side of the interface, in the sidebar you should see all of you folders and files listed. You can click on any of the files to peek at their contents or you can double click a file to open in in the editor.

Go to the menu, click Project and click Save Project As… and then give it a name. It might be best to save the project file in the same folder as your files and sub-folder. The file extension will be sublime-project. Sublime also creates a workspace file that contains transient information about your project as you are working on it, although you won’t see it listed in the sidebar. You will find in in Windows Explorer however. Sublime hides it. It includes the files you have open and the order of the tabs you have open, for example.

You can work on more than one project at a time, switching between them with the Project Switcher. Quick Switch Project is one of the menu items in the Project top menu.

Finding or Replacing across Multiple Files in a Project

The keyboard shortcut in Windows for this function is Ctrl+Shift+F. With this feature you can find or replace all occurrences of text in all of the files in a project. Just leave the Where: part empty. That will appear at the bottom of your screen. The other two boxes to fill are Find: and Replace:.

If you click the Find button on the right (after entering some text to find) you will see a new tab open up with the results. You can jump to the file by double clicking the circled result. You can press F4 to cycle through the files with results.

Leave a comment

Your email address will not be published. Required fields are marked *