about summary refs log tree commit diff
path: root/tools
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-12-24T14·30+0100
committerVincent Ambo <tazjin@google.com>2019-12-24T14·30+0100
commit86c2ebc096973c9b82b130ae8fd5757989458aec (patch)
treecee347518bf93f30fedbf288fd74e37e299c34f4 /tools
parentccd31b88982d1dd2126eb9eb0f03113135db7611 (diff)
feat(emacs.d): Enable edwina package for window management r/296
Configures edwina using `s-w` as the key prefix (in line with my other
EXWM-related commands).

An additional function is added that switches to a buffer (borrowing
the implementation from `ivy-switch-buffer`) but splitting it into a
new window instead.
Diffstat (limited to 'tools')
-rw-r--r--tools/emacs/config/init.el21
1 files changed, 21 insertions, 0 deletions
diff --git a/tools/emacs/config/init.el b/tools/emacs/config/init.el
index b3da4d6bda12..907011b4d9b0 100644
--- a/tools/emacs/config/init.el
+++ b/tools/emacs/config/init.el
@@ -44,6 +44,27 @@
 (use-package dash)
 (use-package dash-functional)
 (use-package dottime :config (dottime-display-mode t))
+
+(use-package edwina
+  :after (ace-window ivy)
+  :init
+  (setq edwina-keymap-prefix (kbd "s-w"))
+  (defun edwina-split-to-buffer ()
+    (interactive)
+    (ivy-read "Switch to buffer: " #'internal-complete-buffer
+              :keymap ivy-switch-buffer-map
+              :preselect (buffer-name (other-buffer (current-buffer)))
+              :action (lambda (buffer)
+                        (let ((new-window (split-window-below)))
+                          (edwina-arrange)
+                          (with-selected-window new-window
+                            (switch-to-buffer buffer nil 'force-same-window))))
+              :matcher #'ivy--switch-buffer-matcher
+              :caller 'ivy-switch-buffer))
+  :bind (:map edwina-mode-map
+              ("s-w b" . #'edwina-split-to-buffer))
+  :config (edwina-mode 1))
+
 (use-package gruber-darker-theme)
 (use-package ht)
 (use-package hydra)