emacs split into 3 even windows

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.


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)

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

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


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

Tags:

Emacs