emacs split into 3 even windows

0 votes
asked Apr 5, 2010 by dirk

Quick question: How do I specify the number of characters in a split window? C-x-3 Splits my window into two windows evenly, but a subsequent split will split one of the windows in half. I'd like 3 equal sized windows. The documentation says that I should be able to specify the number of characters for the left buffer as a parameter, but I cant seem to get that to work. Any ideas for syntax?

Thanks.

6 Answers

0 votes
answered Apr 5, 2010 by nikwin

To specify the number of characters in the split window, do:

C-u number-of-characters C-x 3

0 votes
answered Apr 5, 2010 by josh-matthews

C-x 3 twice followed by C-x + to equally size all windows.

0 votes
answered Apr 5, 2010 by quodlibetor

I have the following in my .emacs:

(defadvice split-window-horizontally (after rebalance-windows activate)
  (balance-windows))
(ad-activate 'split-window-horizontally)

this makes emacs call rebalance-windows (which is what C-x + is bound to by default) after every resize. It's not what I want all the time, but I want it much more often than the default behavior.

0 votes
answered Apr 13, 2011 by xosp7tom

add in .emacs. I mapped to C-x 4, but anyone has a better idea?

(defun split-3-windows-horizontally-evenly ()
  (interactive)
  (command-execute 'split-window-horizontally)
  (command-execute 'split-window-horizontally)
  (command-execute 'balance-windows)
)

(global-set-key (kbd "C-x 4") 'split-3-windows-horizontally-evenly)
0 votes
answered Apr 16, 2013 by wenshan
(defun wenshan-split-window-vertical (&optional wenshan-number)
"Split the current window into `wenshan-number' windows"
  (interactive "P")
  (setq wenshan-number (if wenshan-number
                           (prefix-numeric-value wenshan-number)
                         2))
  (while (> wenshan-number 1)
    (split-window-right)
    (setq wenshan-number (- wenshan-number 1)))
  (balance-windows))

This function can be used to split the current window into N windows, you can type "C-u 3 M-x wenshan-split-window-vertical" to achieve what you want.

0 votes
answered Apr 17, 2016 by pyeleven

If you use evil do C-x 3 and then C-w =

Welcome to Q&A, where you can ask questions and receive answers from other members of the community.
Website Online Counter

...