diff options
author | jao <jao@gnu.org> | 2021-05-02 01:09:48 +0100 |
---|---|---|
committer | jao <jao@gnu.org> | 2021-05-02 01:09:48 +0100 |
commit | c54b15d8563424a1f8760bb187e175cba6ba9fee (patch) | |
tree | 3d596b192e2d147f25c498f3b84e870c7f0b9d44 | |
parent | ac9201a7d7ebc6dc4e4e8f3a542f7f209be585ee (diff) | |
download | elibs-c54b15d8563424a1f8760bb187e175cba6ba9fee.tar.gz elibs-c54b15d8563424a1f8760bb187e175cba6ba9fee.tar.bz2 |
vanilla other-window plus transpose function
-rw-r--r-- | exwm.org | 5 | ||||
-rw-r--r-- | init.org | 54 |
2 files changed, 19 insertions, 40 deletions
@@ -497,6 +497,7 @@ (define-key exwm-mode-map [?\s-w] #'jao-hydra-exwm/body) (define-key exwm-mode-map (kbd "C-c o") #'jao-exwm-pdf-goto-org) (define-key exwm-mode-map (kbd "C-c O") #'jao-exwm-pdf-goto-org*) + (define-key exwm-mode-map (kbd "M-o") #'other-window) (setq exwm-input-global-keys @@ -512,8 +513,8 @@ ([?\s-e] . jao-exwm-firefox-1) ([?\s-t] . jao-vterm-here-toggle) ([?\s-n] . jao-hydra-ednc/body) - ([?\s-O] . switch-window-then-swap-buffer) - ([?\s-o] . switch-window) + ([?\s-O] . jao-transpose-windows) + ([?\s-o] . other-window) ([?\s-r] . app-launcher-run-app) ([?\s-x] . jao-hydra-exwm-misc/body) ([?\s-z] . jao-hydra-sleep/body) @@ -1235,48 +1235,25 @@ (global-set-key (kbd "C-x _") #'delete-other-windows-vertically) #+end_src -*** 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). +*** Transpose #+begin_src emacs-lisp - (use-package switch-window - :ensure t - :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 ((f `(lambda () - (let ((default-directory ,default-directory)) - (call-interactively ',cmd))))) - (switch-window--then prompt f f))) + (defun jao-transpose-windows (arg) + "Transpose the buffers shown in two windows." + (interactive "p") + (let ((selector (if (>= arg 0) 'next-window 'previous-window))) + (while (/= arg 0) + (let ((this-win (window-buffer)) + (next-win (window-buffer (funcall selector)))) + (set-window-buffer (selected-window) next-win) + (set-window-buffer (funcall selector) this-win) + (select-window (funcall selector))) + (setq arg (if (plusp arg) (1- arg) (1+ arg)))))) - (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))) + (define-key ctl-x-4-map (kbd "t") #'jao-transpose-windows) + (global-set-key (kbd "M-O") #'jao-transpose-windows) #+end_src -*** first window and transient other window +*** First window #+begin_src emacs-lisp - (defvar jao-first-window--from nil) (defun jao-first-window () @@ -1288,6 +1265,7 @@ (global-set-key (kbd "s-a") #'jao-first-window) (global-set-key (kbd "H-s-a") #'jao-first-window) + (global-set-key (kbd "M-o") #'other-window) #+end_src *** winner mode #+begin_src emacs-lisp |