From 52acd97103c7a8e98e6b6be5b1136f8b4c9a17e3 Mon Sep 17 00:00:00 2001 From: jao Date: Sun, 7 Mar 2021 05:09:54 +0000 Subject: switch-window style file/buffer-other-window with ace-window --- init.org | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/init.org b/init.org index 57927bb..cb97d95 100644 --- a/init.org +++ b/init.org @@ -1260,6 +1260,7 @@ #+begin_src emacs-lisp (use-package ace-window :ensure t + :demand t :init (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l) aw-char-position 'top-left aw-ignore-current nil @@ -1270,6 +1271,27 @@ :bind (("M-o" . ace-window) ("M-O" . ace-swap-window) ("C-x p" . ace-window))) + + (defun jao-ace-switch-buffer-other-window () + (interactive) + (aw-select "Other window" + (if (eq jao-completion-engine 'consult) + (lambda (w) + (aw-switch-to-window w) + (call-interactively 'consult-buffer)) + #'aw-switch-buffer-in-window))) + + (defun jao-ace-find-file-other-window () + (interactive) + (aw-select "Other window" + (lambda (w) + (let ((df default-directory)) + (aw-switch-to-window w) + (let ((default-directory df)) + (call-interactively 'find-file)))))) + + (global-set-key (kbd "C-x 4 f") #'jao-ace-find-file-other-window) + (global-set-key (kbd "C-x 4 b") #'jao-ace-switch-buffer-other-window) #+end_src *** first window and transient other window #+begin_src emacs-lisp -- cgit v1.2.3