diff options
-rw-r--r-- | attic/misc.org | 41 | ||||
-rw-r--r-- | exwm.org | 8 | ||||
-rw-r--r-- | init.org | 99 |
3 files changed, 93 insertions, 55 deletions
diff --git a/attic/misc.org b/attic/misc.org index dbf621f..d3af11a 100644 --- a/attic/misc.org +++ b/attic/misc.org @@ -500,6 +500,47 @@ :diminish ((rcirc-omit-mode . ""))) #+end_src +* nth window + #+begin_src emacs-lisp + (defun jao--nth-window (n) + (let ((jao-minibuffer-mode nil) + (ignore-window-parameters t)) + (select-window (frame-first-window)) + (other-window n)) + (jao-minibuffer-refresh)) + + (defalias 'jao-other-window 'other-window) + + ;; (global-set-key (kbd "M-o") #'jao-other-window) + + (global-set-key (kbd "C-c 0") #'jao-first-window) + (dolist (n '(0 1 2 3 4 5 6 7 8)) + (global-set-key (format "\C-c%s" (1+ n)) + (lambda () (interactive) (jao--nth-window n)))) + + #+end_src +* transpose + #+begin_src emacs-lisp + (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 (> arg 0) (1- arg) (1+ arg)))))) + + (defun jao-transpose-windows-prev () + (interactive) + (jao-transpose-windows -1)) + + (define-key ctl-x-4-map (kbd "t") #'jao-transpose-windows) + (global-set-key (kbd "M-O") #'jao-transpose-windows) + (global-set-key (kbd "M-P") #'jao-transpose-windows-prev) + #+end_src * ace-window #+begin_src emacs-lisp (defun jao-ace-switch-buffer-other-window () @@ -534,9 +534,11 @@ ([?\s-b] . jao-transient-org-blog) ([?\s-e] . jao-exwm-toggle-firefox) ([?\s-m] . jao-transient-media) - ([?\s-O] . jao-transpose-windows) - ([?\s-o] . jao-other-window) - ([?\s-P] . jao-transpose-windows-prev) + ;; ([?\s-O] . jao-transpose-windows) + ;; ([?\s-o] . jao-other-window) + ;; ([?\s-P] . jao-transpose-windows-prev) + ([?\s-O] . ace-swap-window) + ([?\s-o] . ace-window) ([?\s-p] . jao-prev-window) ([?\s-R] . app-launcher-run-app) ([?\s-r] . jao-recoll-transient) @@ -1117,25 +1117,27 @@ :ensure t :diminish :custom ((pulsar-pulse-functions - '(recenter-top-bottom - move-to-window-line-top-bottom - reposition-window - other-window - delete-window + '(ace-window + backward-page delete-other-windows + delete-window forward-page - backward-page - scroll-up-command - scroll-down-command + jao-prev-window + move-to-window-line-top-bottom + org-backward-heading-same-level + org-forward-heading-same-level org-next-visible-heading org-previous-visible-heading - org-forward-heading-same-level - org-backward-heading-same-level + other-window outline-backward-same-level outline-forward-same-level outline-next-visible-heading outline-previous-visible-heading - outline-up-heading)) + outline-up-heading + recenter-top-bottom + reposition-window + scroll-down-command + scroll-up-command)) (pulsar-pulse t) (pulsar-delay 0.1) (pulsar-iterations 10) @@ -1147,7 +1149,7 @@ #+end_src * Windows -*** Scrolling +*** scrolling #+begin_src emacs-lisp (setq scroll-preserve-screen-position 'always scroll-conservatively most-positive-fixnum @@ -1155,7 +1157,7 @@ scroll-step 2 redisplay-skip-fontification-on-input t) #+end_src -*** Splitting and switch +*** splitting and switch #+begin_src emacs-lisp (setq split-height-threshold 80 split-width-threshold 144) @@ -1168,29 +1170,7 @@ (global-set-key (kbd "C-x _") #'delete-other-windows-vertically) #+end_src -*** Transpose - #+begin_src emacs-lisp - (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 (> arg 0) (1- arg) (1+ arg)))))) - - (defun jao-transpose-windows-prev () - (interactive) - (jao-transpose-windows -1)) - - (define-key ctl-x-4-map (kbd "t") #'jao-transpose-windows) - (global-set-key (kbd "M-O") #'jao-transpose-windows) - (global-set-key (kbd "M-P") #'jao-transpose-windows-prev) - #+end_src -*** Window navigation +*** first window #+begin_src emacs-lisp (defvar jao-first-window--from nil) @@ -1207,24 +1187,39 @@ (interactive) (other-window -1)) - (defun jao--nth-window (n) - (let ((jao-minibuffer-mode nil) - (ignore-window-parameters t)) - (select-window (frame-first-window)) - (other-window n)) - (jao-minibuffer-refresh)) + (global-set-key (kbd "C-x p") #'jao-prev-window) + (global-set-key (kbd "s-a") #'jao-first-window) - (defalias 'jao-other-window 'other-window) + #+end_src +*** ace window + #+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 + aw-dispatch-when-more-than 2 + aw-leading-char-style 'path + aw-display-mode-overlay t + aw-scope 'frame) + :config - (global-set-key (kbd "s-a") #'jao-first-window) - (global-set-key (kbd "C-x p") 'jao-prev-window) - (global-set-key (kbd "M-o") #'jao-other-window) - (global-set-key (kbd "M-p") #'jao-prev-window) - - (global-set-key (kbd "C-c 0") #'jao-first-window) - (dolist (n '(0 1 2 3 4 5 6 7 8)) - (global-set-key (format "\C-c%s" (1+ n)) - (lambda () (interactive) (jao--nth-window n)))) + (defun jao-ace-consult-buffer-other-window (w) + (interactive) + (aw-switch-to-window w) + (consult-buffer)) + + (setf (alist-get ?b aw-dispatch-alist) + '(jao-ace-consult-buffer-other-window "Consult buffer")) + + (setf (alist-get ?B aw-dispatch-alist) + (alist-get ?u aw-dispatch-alist)) + + + :bind (("s-o" . ace-window) + ("s-O" . ace-swap-window) + ("C-x 4 t" . ace-swap-window))) #+end_src *** winner mode |