summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--exwm.org5
-rw-r--r--init.org54
2 files changed, 19 insertions, 40 deletions
diff --git a/exwm.org b/exwm.org
index db82272..00379f3 100644
--- a/exwm.org
+++ b/exwm.org
@@ -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)
diff --git a/init.org b/init.org
index 3e2052d..f01bda4 100644
--- a/init.org
+++ b/init.org
@@ -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