summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorjao <jao@gnu.org>2021-03-25 03:40:43 +0000
committerjao <jao@gnu.org>2021-03-25 03:40:43 +0000
commitec9aa2881c1bfd3cfde296f84d9fb71490961cc0 (patch)
tree0cde0a02d5c7ebebcad4caf1e0f01f793a37dcb5
parent3815e003ffd6ba245938c67f5ecebcdf75e90226 (diff)
downloadelibs-ec9aa2881c1bfd3cfde296f84d9fb71490961cc0.tar.gz
elibs-ec9aa2881c1bfd3cfde296f84d9fb71490961cc0.tar.bz2
back to switch-window
-rw-r--r--exwm.org8
-rw-r--r--init.org80
2 files changed, 43 insertions, 45 deletions
diff --git a/exwm.org b/exwm.org
index b94e250..e45ff39 100644
--- a/exwm.org
+++ b/exwm.org
@@ -453,7 +453,7 @@
:toggle jao-minibuffer-enabled-p))))
#+end_src
* Keybindings
- #+BEGIN_SRC emacs-lisp
+ #+begin_src emacs-lisp
(define-key exwm-mode-map [?\C-q] #'exwm-input-send-next-key)
(define-key exwm-mode-map [?\s-f] #'jao-hydra-float/body)
(define-key exwm-mode-map [?\s-m] #'jao-hydra-media/body)
@@ -476,8 +476,8 @@
([?\s-e] . jao-exwm-firefox-1)
([?\s-t] . jao-vterm-here-toggle)
([?\s-n] . jao-hydra-ednc/body)
- ([?\s-O] . ace-swap-window)
- ([?\s-o] . ace-window)
+ ([?\s-O] . switch-window-then-swap-buffer)
+ ([?\s-o] . switch-window)
([?\s-x] . jao-hydra-exwm-misc/body)
([?\s-z] . jao-hydra-sleep/body)
([XF86AudioMute] . jao-mixer-master-toogle)
@@ -502,4 +502,4 @@
;; (customize-set-variable 'exwm-input-global-keys exwm-input-global-keys)
- #+END_SRC
+ #+end_src
diff --git a/init.org b/init.org
index 0dac37b..b0b77f9 100644
--- a/init.org
+++ b/init.org
@@ -1255,49 +1255,47 @@
(global-set-key (kbd "C-x _") #'delete-other-windows-vertically)
#+end_src
-*** ace-window
- An alternative is switch-window. The problem with it is that
- commands such as C-x 4 f will use as default-dir the destination's
- rather than the origin's, which kills the fun of it. ace-window
- is not without warts, notably, lack of overlay for org buffers,
- although, to be fair, that's possibly org's fault (but then, why
- does switch-window's overlays work?).
- #+begin_src emacs-lisp
- (use-package ace-window
+*** switch window
+ An alternative for this one is ace-window, but it has the problem
+ of not displaying its overlay over org buffers (sometimes) and
+ introducing a dependency (avy).
+ #+begin_src emacs-lisp :load no
+ (use-package switch-window
:ensure t
:demand t
- :init (setq aw-keys '(?a ?s ?d ?f ?g ?h ?j ?k ?l ?\;)
- aw-ignore-current nil
- aw-dispatch-when-more-than 3
- aw-leading-char-style 'path
- aw-display-mode-overlay t
- aw-scope 'frame)
- :bind (("M-o" . ace-window)
- ("M-O" . ace-swap-window)
- ("H-s-o" . ace-window)
- ("H-s-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)
+ :custom ((switch-window-minibuffer-shortcut ?z)
+ (switch-window-background t)
+ (switch-window-shortcut-style 'qwerty)
+ (switch-window-timeout 7)
+ (switch-window-threshold 3))
+ :config
+ (defun jao-switch-window--then (prompt cmd)
+ (let ((d default-directory))
+ (switch-window--then prompt
+ cmd
+ `(lambda ()
+ (let ((default-directory ,d))
+ (call-interactively ',cmd))))))
+
+ (defun jao-switch-window-then-dired ()
+ (interactive)
+ (jao-switch-window--then "Find directory" 'dired))
+
+ (defun jao-switch-window-then-find-file ()
+ (interactive)
+ (jao-switch-window--then "Find file" 'find-file))
+
+ (defun jao-switch-window-then-consult-buffer ()
+ (interactive)
+ (jao-switch-window--then "Switch to buffer" 'consult-buffer))
+
+ :bind (("M-o" . switch-window)
+ ("M-O" . switch-window-then-swap-buffer)
+ ("H-s-o" . switch-window)
+ ("H-s-O" . switch-window-then-swap-buffer)
+ ("C-x 4 d" . jao-switch-window-then-dired)
+ ("C-x 4 f" . jao-switch-window-then-find-file)
+ ("C-x 4 b" . jao-switch-window-then-consult-buffer)))
#+end_src
*** first window and transient other window
#+begin_src emacs-lisp