aboutsummaryrefslogtreecommitdiff
path: root/.emacs.d/init.org
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2021-04-12 15:27:29 +0200
committerMiquel Sabaté Solà <msabate@suse.com>2021-04-12 15:27:29 +0200
commitc27ea4f0016bbdd426888c9311b54d5be9e047e3 (patch)
treea1ac2f6445f3454045223a4a0fd35a1fdf7cbb5d /.emacs.d/init.org
parent42a084b287bd1184cdd9815409efc363b1286fbf (diff)
downloaddotfiles-c27ea4f0016bbdd426888c9311b54d5be9e047e3.tar.gz
dotfiles-c27ea4f0016bbdd426888c9311b54d5be9e047e3.zip
emacs: simplify my window management
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to '.emacs.d/init.org')
-rw-r--r--.emacs.d/init.org19
1 files changed, 19 insertions, 0 deletions
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:<kbd>C-z</kbd>@@, 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