I just started using emacs and since I have been using Sublime Text for a while, I am used to the four-grid-layout with 4 windows stacked horizontally and vertically. I have been able to split the screen horizontally only. How do I split it 4 ways?
Asked
Active
Viewed 1.2k times
2 Answers
15
To split the window in half with a vertical divider, use the command split-window-right
. To split it in half with a horizontal divider, use the command split-window-below
.
For example, assume we have this window by default:
.-------------.
| |
| |
| |
| |
| |
'-------------'
M-x split-window-right RET
:
.-------------.
| | |
| | |
| | |
| | |
| | |
'-------------'
M-x split-window-below RET
:
.-------------.
| |
| |
|-------------|
| |
| |
'-------------'
split-window-right
is bound to C-x 3
by default. split-window-below
is bound to C-x 2
by default.
ErgoEmacs has a good guide on window management and navigation, including how to save a specific arrangement (e.g. a 4-way split) and load it automatically.

JCC
- 989
- 5
- 15
-
Thanks for that. It works. How do I jump from one window to the other without `C-X o`. Say, I want to jump to the right window to the current one, how do I do that? – twodee Sep 12 '16 at 16:32
-
1@CoderDudeTwodee: in general, please post a separate question rather than follow up in comments. In this case, though, you could consider using [`windmove`](https://www.emacswiki.org/emacs/WindMove). – Dan Sep 12 '16 at 16:40
-
@Dan thank you, I found out `windmove` in another emacs question. – twodee Sep 12 '16 at 16:43
-
The ErgoEmacs link covers that, among other things. Glad to help! – JCC Sep 12 '16 at 18:40
9
Use the split-window-xxx commands, as described in another answer. If you always want a grid of 4 windows, here's a command you could use:
(defun split-4-ways ()
(interactive)
(delete-other-windows)
(split-window-right)
(split-window-below)
(windmove-right)
(split-window-below)
(windmove-left))

glucas
- 20,175
- 1
- 51
- 83