Split into multiple windows vertically
In standard Emacs, pressing C-x 3
will call function split-window-right
to split the current window into two identical windows. Sometimes I want to get more than two windows, so I wrote this little function:
(defun wenshan-split-window-vertical (&optional wenshan-number)
"Split the current window into `wenshan-number' windows and balance all 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))
It calls split-window-right multiple times to get multiple new windows and finally calls balance-window to adjust the sizes of all windows. eval
this function, then you could press M-x wenshan-split-window-vertical
(thanks to the auto-completion functionality, you won’t need to type all these characters) to call it.
Reference:
- Delete the file corresponding to the current buffer
- Alarm for Breaks
- Insert source code block in org-mode
- Edit current file as root
- Getting rid of mouse
My site is free of ads and trackers. Was this post helpful to you? Why not
Disqus is great for comments/feedback but I had no idea it came with these gaudy ads.