Home Download Buy Blog Forum Support

How to split screen, code on left, output on right

How to split screen, code on left, output on right

Postby Tuanglen on Sat Aug 25, 2012 4:28 am

Most editors I've used have made it easy to split your screen left and right, putting your code in the left half of the screen and your output on the right, maximizing the number of lines of each that are simultaneously visible. I'm just now trying out ST2, so I'm a complete newbie. I've got my output coming out in a little horizontal strip on the bottom of the screen, which can't be right. I can only see two or three lines of output at a time, yet it still blocks my view of the code, while the right side of the screen is nearly empty and useless. I obviously need to change the layout, but I don't see anything in the "View" menu for doing so.

It's probably right in front of me or buried in one of the countless text-based prefs files, either of which is fine with me, but I can't see it. It's probably head-slappingly obvious, but could someone please tell me how to split the screen, left=code, right=output? Thanks.
Tuanglen
 
Posts: 15
Joined: Wed Aug 22, 2012 8:17 am

Re: How to split screen, code on left, output on right

Postby madnomad on Sat Aug 25, 2012 11:05 am

Sadly it's not possible to set the position of any window panels.
I think it's possible to write a plugin that creates a view in the second group and redirect the output there though...
Or you could simply keep them open in two different windows side by side (you can increase the height of console panel).
madnomad
 
Posts: 18
Joined: Tue Aug 14, 2012 8:34 pm

Re: How to split screen, code on left, output on right

Postby Tuanglen on Sat Aug 25, 2012 7:57 pm

I got your idea to work (thanks), but it's such a kluge that it's not worth doing. You have to open two windows side by side and have them view the same file. You then set the one on the left to "Hide Console" and the one on the right to "Show Console". You drag the console in the right window up to cover the window. (If you don't have the right window viewing the file back behind the console, it won't work. The console will display your commands ("Running python - u /../../hello.py") but won't display your output.)

You then edit code on the left side, but you have to remember to synchronize the invisible code behind the console on the right or you'll get the wrong output. You have to manually save the left window. Even if you have the "save all windows on build" option set to true, it won't save your edits on the left if you build on the right. (If you build on the left, it will save, but it will pop up another console, covering your code, and you won't get any output on the right anyway.) After remembering to save first on the left, you click on the right to change focus. This causes a reload of the code behind the console. You then build and get your output and repeat.

I would have to go through this for every new file I opened, and it would eliminate full screen, distraction-free mode, and who knows what else.

It's just not worth doing, especially given how many other editors let you easily edit code on the left side and see your output on the right, including most free ones I've used. Komodo Edit is powerful, free, and you just right click a tab and tell it where you want it. Other powerful editors like BBEdit, Textmate, Visual Studio, Eclipse, all do it, but even the little freebie editors implement this feature before their editing power goes beyond Notepad with line numbers.

I like a lot of what I see in Sublime Text---lots of good ideas---but how can there be so MANY preferences and features without the basic ability to see the results of your edits (the output) at a keystroke and a glance, right there beside your code? As far as productivity enhancement, that ranks near the top. If your code is for a GUI app, a Web page, a PDF, TeX, you would need a specialty viewer, but text output in a text editor? Why isn't that in the View > Layout... menu?

How are the rest of you Sublime Text lovers (and there's a lot to love, IMO) viewing your text output as you work? What is your edit, check output, edit, check output process for text output?
Tuanglen
 
Posts: 15
Joined: Wed Aug 22, 2012 8:17 am

Re: How to split screen, code on left, output on right

Postby xeno.by on Sat Aug 25, 2012 9:03 pm

I modified exec.py from standard distribution to open in a view rather than in a panel.
xeno.by
 
Posts: 106
Joined: Mon Jan 30, 2012 10:03 am
Location: Lausanne, Switzerland

Re: How to split screen, code on left, output on right

Postby Grant on Mon Aug 27, 2012 11:29 am

xeno.by wrote:I modified exec.py from standard distribution to open in a view rather than in a panel.
I'm sure it's a fairly simple thing to do, but do you mind sharing what lines you modified?
Grant
 
Posts: 68
Joined: Fri Jan 20, 2012 2:42 pm

Re: How to split screen, code on left, output on right

Postby xeno.by on Mon Aug 27, 2012 11:40 am

https://github.com/xeno-by/dotsublime/b ... y#L118-122 (but the file not only contains the "open in a normal view" modification, but also other stuff I use, e.g. the "no_history" setting - to be honest, I don't even remember why I introduced it in the first place =)).

So back to the topic. Basically instead of:
Code: Select all
self.window.get_output_panel("exec")

you write something like:
Code: Select all
wannabes = filter(lambda v: v.name() == (title or " ".join(cmd)), self.window.views())
self.output_view = wannabes[0] if len(wannabes) else self.window.new_file()
self.output_view.set_name(title or " ".join(cmd))
self.output_view.set_scratch(True)

Probably you'll want to add the "title" parameter to ExecCommand (I don't remember whether it was there before, or I added it myself).
xeno.by
 
Posts: 106
Joined: Mon Jan 30, 2012 10:03 am
Location: Lausanne, Switzerland

Re: How to split screen, code on left, output on right

Postby gekko on Mon Aug 27, 2012 1:08 pm

Thanks!
Works like a charm!

Can we get this as a regular feature?
gekko
 
Posts: 9
Joined: Mon Aug 27, 2012 8:29 am

Re: How to split screen, code on left, output on right

Postby joeyespo on Tue Nov 06, 2012 3:14 pm

If anyone is interested, I created a plugin to redirect the output to an external console window like other editors do. It better fits my workflow and addresses some issues with the integrated console window.

Feedback appreciated!

https://github.com/joeyespo/sublimetext-console-exec
joeyespo
 
Posts: 7
Joined: Sun Jul 29, 2012 9:38 pm
Location: Pittsburgh, PA


Return to General Discussion

Who is online

Users browsing this forum: No registered users and 28 guests