From c27ea4f0016bbdd426888c9311b54d5be9e047e3 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Mon, 12 Apr 2021 15:27:29 +0200 Subject: emacs: simplify my window management MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- .emacs.d/init.org | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to '.emacs.d/init.org') diff --git a/.emacs.d/init.org b/.emacs.d/init.org index 53943a5..3c368a8 100644 --- a/.emacs.d/init.org +++ b/.emacs.d/init.org @@ -446,6 +446,25 @@ Window navigation and management is done through =evil-mode=, which basically se (global-set-key (kbd "C-x V") (lambda () (interactive) (split-window-right) (other-window 1))) #+END_SRC +Other than that, for just splitting the current window I follow a pretty dumb algorithm: + +#+BEGIN_SRC elisp +(defun mssola-just-split () + "Just split the current window sensibly. +My workflow for having multiple windows is actually pretty stupid: just split so +the new buffer has as much space as possible. That is, if we have more width +than height for the current window, just split vertically, and vice versa." + + (interactive) + + (if (< (window-pixel-width) + (window-pixel-height)) + (split-window-vertically) + (split-window-horizontally))) + +(global-set-key (kbd "C-x j") 'mssola-just-split) +#+END_SRC + Disable @@html:C-z@@, which will be later on be picked up by =evil-mode= configuration as the escape sequence. This is here to make sure that it will be disabled even if =evil-mode= is not on. #+BEGIN_SRC elisp -- cgit v1.2.3