Suppose I have a python file which plot a simple sin(a*x)
function. In sublime text, when I press command+B
, the plot shows.
However, suppose I need to change the parameter a
and compare the figure with the current one. A simple second press of command+B
just close the current plot and generate a new one, which is not what I want cause I want to compare them side by side.
In PyCharm you have allow parallel run
option, I wonder if sublime text can achieve this.
Advertisement
Answer
In Sublime Text you have the option to open multiple terminals in multiple tabs, allowing you to keep 2 versions of the same python file running simultaneously. Here is a GIF demonstrating that:
Here are the steps:
Open the Command Pallette. It can be found in the Tools tab in the menu bar.
Enter “Terminus tab” into the search box and select the only option that will be displayed. A new tab will be opened, and there you can navigate to where your python file is located.
For the second terminal, repeat step 2.
Now you can run the same python file indepentantly in the 2 teminal tabs.
To have the two terminal windows displayed below the python file, go to the “View” tab, then “Layout”, and select the “Rows: 2” option (the window will be split into 2 windows). Open a terminus tab in the bottom window. Then, go to the Command Palette and enter “Terminus toggle” and select the only option. Now you have two terminal windows at the bottom of your file. Here is a GIF to demonstrate:
To have the terminals to be displayed side-by-side horizontally and not vertically (like demonstrated above), select the “Grid: 4” instead of the “Columns: 2” option and open a terminus tab in the bottom two windows. Here is a GIF to demonstrate: