Join Kevin Yank for an in-depth discussion in this video Working on multiple files at once, part of Learning Sublime Text 2.
Often you'll find yourself needing to refer to one file while making changes to another, and that's where split window views come in really handy. I'm going to maximize my window here to give us a bit more space to work, and now if you go to the View menu and choose Layout, you can see there's a bunch of different window layouts to choose from here. Depending on how you prefer to work, you might like Columns or Rows, I personally work in the two-Column view a lot. In whichever view you end up using, you might want to familiarize yourself with the keyboard shortcuts for them.
So, I'm going to split my view into two columns, and then I can drag a file from one side over to the other. And there we go, I have two files opened side by side, and I can work on them at the same time. I can even switch between the two splits using my keyboard using the Ctrl key and a number, and this is the same on Mac and Windows. If I hit Ctrl+1, it takes me to the left-hand side, Ctrl+2 takes me to the right-hand side. If we have more than two splits then you have keys Ctrl+3, Ctrl+4, and so on. An advanced version of this is having multiple tabs for the same file.
So let's look at our index.htm file here. Maybe I want to work on the navigation while referring to another part of the file. Well, I can go to the File menu and choose New View Into File, and this gives me another tab for index.htm. It's another view into that same open file, and I can drag it over to the right-hand side here, and then while I'm looking at another part of the file on this side, I can edit my navigation. So let's say I want to changes from programs to programming.
If I scroll up, I can see that, that change took place on both sides, and I can edit on one side and see the changes affect both sides at once. So it's truly two separate windows into the same open file. This comes in handy a lot more than you'd expect if you know that feature is there in your editor, and now you do.
- Opening, viewing, and editing files
- Adding custom themes and color schemes
- Performing different types of find and replace operations
- Editing multiple lines simultaneously
- Automating tasks with macros and snippets
- Working with add-ons like Package Control, Line Endings, and Hyperlink Helper