Sublime Text — Working with Multiple Panes

July 26, 2012 by Gabe | [mmd] |

Sublime Text 2 supports multiple view panes. Panes split the window into vertical and horizontal views that contain document tabs. Each pane can contain multiple tabs.

The views are independent but joined together. They are two (or more) views on the same text buffer and all views are updated as one pane is modified (it is not necessary to save the document to update the other views).

Origami is a better way to manage multiple panes in Sublime Text 2. Rather than use the limited layout tool, Origami provides actions to clone the current document to a new horizontal or vertical pane. For example, while working on a long post to this site, I will clone the current document into a new pane with Origami.

I scroll the bottom pane to the bottom of the document and position the cursor on a new line. I then return to my writing in the top pane. When I want to create a new footnote, I hit ⌘-K and then the down arrow. The lower pane is selected and the cursor is where I positioned it when I created the pane. I then create the footnote. Hitting ⌘-K and the upper arrow returns me to where I was typing.

Views are also a tremendous help for editing large documents. For example split the view between two different chapters of the same document to cross reference and check consistency. Each view maintains its own cursor position and text selection.

I also use one cloned view for searching and one for editing. That way doing a search does not change my current editing position.

All of this can be done without the Origami plugin through the various View sub-menus. For example, create a new view from the current document:

Set the layout to horizontal split:

Each view group can contain multiple tabs. This is particularly convenient while working in full screen mode. ST2 is full screen but I can still have multiple document windows open for working and they can coexist side-by-side.

The default shortcut for switching group focus is ctrl-1, ctrl-2, and so on, but that conflicts with the OS X Spaces switcher for me. Even though it is more key presses, I prefer the Origami shortcuts.

⌘-K and then:

  • Arrows: travel to an adjacent pane
  • shift-Arrow: carry the current file to the destination
  • alt-Arrow (option): clone the current file to the destination
  • ⌘-Arrow: create an adjacent pane
  • -shift-Arrow: destroy an adjacent pane

There is also a sidebar for viewing the list of groups. Clicking on a group name switches focus.

The Sublime Text views are really nice. Other editors may have similar features, but I think ST2 nails it.

tags
blog comments powered by Disqus