When I have 2 columns set in a Sublime Text window, can I display the same file in both columns?
9 Answers
Yes, you can. When a file is open, click on File -> New View Into File
. You can then drag the new tab to the other pane and view the file twice.
There are several ways to create a new pane. As described in other answers, on Linux and Windows, you can use AltShift2 (Option ⌥Command ⌘2 on OS X), which corresponds to View → Layout → Columns: 2
in the menu. If you have the excellent Origami
plugin installed, you can use View → Origami → Pane → Create → Right
, or the CtrlK, Ctrl→ chord on Windows/Linux (replace Ctrl with ⌘ on OS X).
![](../../users/profiles/1426065.webp)
- 90,104
- 20
- 213
- 210
-
12Ctrl+Shift+2 shortcut for split screen and drag the file over – zadubz Dec 18 '14 at 14:15
-
You can also use Windows+Ctrl+arrow key to arrange windows. – Shital Shah Apr 15 '16 at 07:22
-
The cmd in the next post works - shift + Alt + 2 to split into 2 screens, not this one below. – LED Fantom Oct 21 '16 at 17:12
-
@LEDFantom When you say this answer doesn't work, what do you mean? The OP already knew how to create split windows, which is why I didn't explain how to do that in my answer. I'm not sure what the downvote is for. – MattDMo Oct 21 '16 at 17:32
-
@MattDMo , I see what you meant now. How do I remove the down vote? – LED Fantom Oct 22 '16 at 02:28
-
@LEDFantom I just edited the post, so you can remove it if you wish. Thanks! – MattDMo Oct 22 '16 at 03:41
-
It makes me sad that this option is in the File menu and not the View menu. – Reverse Engineered Dec 11 '17 at 15:45
Its Shift + Alt + 2 to split into 2 screens. More options are found under the menu item View -> Layout.
Once the screen is split, you can open files using the shortcuts:
1. Ctrl + P (From existing directories within sublime) or
2. Ctrl + O(Browse directory)
-
2To expand, CTRL + P will allow you to "open" the same file more than once. – jayflo Jun 23 '16 at 20:13
-
Inside sublime editor,Find the Tab named View
,
View --> Layout --> "select your need"
![](../../users/profiles/3442874.webp)
- 1,254
- 9
- 18
-
1`View --> Layout --> "select your need" ` select your needs = [single,columns,rows,grids]. So this means the options available when you go to Layout .try out first ,Tested in Sublime 2. – sg28 Jan 29 '16 at 23:02
-
appreciate the menu navigation instead of just a shortcut which happens to work for some users and doesn't explain what sublime feature is in use - which the menu clearly defines. :) – keen Dec 22 '17 at 17:17
-
This should be the only accepted, this is what worked for me. The accepted one doesn't work anymore. Probably it doesn't work in current versions. – VaTo Jan 08 '19 at 23:11
Here is a simple plugin to "open / close a splitter" into the current file, as found in other editors:
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.focus_group(0)
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]]
})
Save it as Packages/User/split_pane.py
and bind it to some hotkey:
{"keys": ["f6"], "command": "split_pane"},
If you want to change to vertical split change with following
"cols": [0.0, 0.46, 1.0],
"rows": [0.0, 1.0],
"cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
I regularly work on the same file in 2 different positions. I solved this in Sublime Text 3 using origami and chain with some additional config.
My workflow is Ctrl + k + 2 splits the view of the file in two (horizontal) panes with the lower one active. Use Ctrl + k + o to toggle between the panes. When done ensure the lower pane is the active and press Ctrl + F4 to close the duplicated view and the pane.
In sublime global settings (not origami settings!) add
"origami_auto_close_empty_panes": true,
Add the following shortcuts
{ "keys": ["ctrl+k", "2"],
"command": "chain",
"args": {
"commands": [
["create_pane", {"direction": "down"}],
["clone_file_to_pane", {"direction": "down"}],
],
}
},
{ "keys": ["ctrl+k", "o"], "command": "focus_neighboring_group" },
-
to make the `chain` command work (seen in the shortcut), you will also need the [Chain of Command package](https://packagecontrol.io/packages/Chain%20of%20Command) installed. – wehal3001 Sep 12 '16 at 21:19
-
@wehal3001 Thanks, updated (also updated the globals settings, where the wrong setting was pasted). – mrtnlrsn Sep 13 '16 at 06:48
I would suggest you to use Origami. Its a great plugin for splitting the screen. For better information on keyboard short cuts install it and after restarting Sublime text open Preferences->
Package Settings ->
Origami ->
Key Bindings - Default
For specific to your question I would suggest you to see the short cuts related to cloning of files in the above mentioned file.
![](../../users/profiles/3970917.webp)
- 96
- 2
- 11
It is possible to edit same file in Split mode. It is best explained in following youtube video.
![](../../users/profiles/6911824.webp)
- 181
- 1
- 5
View -> Layout -> Choose one option or use shortcut
Layout Shortcut
Single Alt + Shift + 1
Columns: 2 Alt + Shift + 2
Columns: 3 Alt + Shift + 3
Columns: 4 Alt + Shift + 4
Rows: 2 Alt + Shift + 8
Rows: 3 Alt + Shift + 9
Grid: 4 Alt + Shift + 5
![](../../users/profiles/5618326.webp)
- 2,120
- 1
- 18
- 32
Kinda little late but I tried to extend @Tobia's answer to set the layout "horizontal" or "vertical" driven by the command argument e.g.
{"keys": ["f6"], "command": "split_pane", "args": {"split_type": "vertical"} }
Plugin code:
import sublime_plugin
class SplitPaneCommand(sublime_plugin.WindowCommand):
def run(self, split_type):
w = self.window
if w.num_groups() == 1:
if (split_type == "horizontal"):
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]]
})
elif (split_type == "vertical"):
w.run_command('set_layout', {
"cols": [0.0, 0.46, 1.0],
"rows": [0.0, 1.0],
"cells": [[0, 0, 1, 1], [1, 0, 2, 1]]
})
w.focus_group(0)
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]]
})
![](../../users/profiles/3491935.webp)
- 183
- 1
- 8