diff options
-rw-r--r-- | exwm.org | 8 | ||||
-rw-r--r-- | init.org | 80 |
2 files changed, 43 insertions, 45 deletions
@@ -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 @@ -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 |