Home Download Buy Blog Forum Support

split view

split view

Postby handycam on Thu May 31, 2012 12:19 pm

how do you split the current view into 2? If I hav a document open, and want two views of the same doc, I choose "layout > 2 rows" but then I get an empty bottom row. There seems to be no way to get the current document into it.

I must be missing something here.
Mac OS 10.11b1
ST 3 (3092)
handycam
 
Posts: 277
Joined: Tue Jan 03, 2012 2:42 pm

Re: split view

Postby quarnster on Thu May 31, 2012 12:51 pm

Menu item "File->New view into File"
quarnster
 
Posts: 389
Joined: Tue Nov 29, 2011 11:34 am

Re: split view

Postby handycam on Thu May 31, 2012 1:36 pm

quarnster wrote:Menu item "File->New view into File"


And then drag the tab down to the new tab bar? That seems to work, thanks. But it does seem like a lot of work to simply split a document into 2 scrolling view, plus both views have a tab.

I guess I am used to BBEdit, just drag the "splitter" on the scroll bar and voila.

Image
Mac OS 10.11b1
ST 3 (3092)
handycam
 
Posts: 277
Joined: Tue Jan 03, 2012 2:42 pm

Re: split view

Postby stirrell on Fri Jun 01, 2012 12:30 am

I agree that having to split the window isn't very intuitive. A lot of times I just want to reference another portion of the file I am working on and don't want to split the window for all other files open. Hopefully this will be addressed at some point. I haven't seen a way to just split the window for the current document unless I am missing something.

Scott
stirrell
 
Posts: 12
Joined: Thu Jan 12, 2012 4:04 pm
Location: South Portland, ME

Re: split view

Postby bizoo on Fri Jun 01, 2012 7:25 am

handycam wrote:And then drag the tab down to the new tab bar? That seems to work, thanks. But it does seem like a lot of work to simply split a document into 2 scrolling view, plus both views have a tab.

You can create the splitted layout and move the cloned view to the second group automatically with something like this:
Code: Select all
import sublime_plugin

class CloneFileToGroupCommand(sublime_plugin.WindowCommand):
    def run(self):
        if self.window.num_groups() == 1:
            self.window.run_command('set_layout',
                            {
                                "cols": [0.0, 0.5, 1.0],
                                "rows": [0.0, 1.0],
                                "cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
                            })
        self.window.run_command('clone_file')
        self.window.run_command('move_to_group', {"group": 1})

or even with a macro.

It's probably possible to analyze the current layout, add another group next to the current one and clone the view to this group.
And maybe save the old layout for reverting to it when you finished the work.
But with the tabs bar (which I don't show), it's doesn't look great.
bizoo
 
Posts: 955
Joined: Wed Dec 08, 2010 6:53 am
Location: Switzerland

Re: split view

Postby tobia on Thu Jul 31, 2014 3:44 pm

Here's the code I'm using, in case others find it useful.

It can be bound to a single key which will make a split view into the current file, just like dragging the horizontal splitter in other editors, or close the split view if it's open.

This is meant for somebody who uses the Single layout. If you are already using other layouts, then you'll have to look into more elaborate plugins, such as Origami.

Code: Select all
import sublime_plugin

class SplitPaneCommand(sublime_plugin.WindowCommand):
   def run(self):
      w = self.window
      if w.num_groups() == 1:
         w.run_command('set_layout', {
            'cols': [0.0, 1.0],
            'rows': [0.0, 0.33, 1.0],
            'cells': [[0, 0, 1, 1], [0, 1, 1, 2]]
         })
         w.run_command('clone_file')
         w.run_command('move_to_group', {'group': 1})
         w.focus_group(1)
      else:
         w.focus_group(1)
         w.run_command('close')
         w.run_command('set_layout', {
            'cols': [0.0, 1.0],
            'rows': [0.0, 1.0],
            'cells': [[0, 0, 1, 1]]
         })
tobia
 
Posts: 14
Joined: Tue Oct 16, 2012 2:55 pm


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 21 guests