Sublime Forum

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

#1

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.

0 Likes

#2

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).

0 Likes

#3

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?

0 Likes

#4

I modified exec.py from standard distribution to open in a view rather than in a panel.

0 Likes

#5

I’m sure it’s a fairly simple thing to do, but do you mind sharing what lines you modified?

0 Likes

#6

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:

self.window.get_output_panel("exec")

you write something like:

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).

0 Likes

#7

Thanks!
Works like a charm!

Can we get this as a regular feature?

0 Likes

#8

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!

github.com/joeyespo/sublimetext-console-exec

0 Likes

#9

You can find solution to this at the below mentioned link, simple steps to follow.

Script to the left and Result to the right of the screen

0 Likes