~tsdh/switchy-window

c743c47b7b4326c411470ba98410b7bfe3685edc — Tassilo Horn 1 year, 2 months ago 682bcec main
Release 1.3 with improved suggestion for substituting other-window
2 files changed, 10 insertions(+), 19 deletions(-)

M README.md
M switchy-window.el
M README.md => README.md +7 -10
@@ 27,14 27,8 @@ globally.  Here are is a sample configuration:
(keymap-set switchy-window-minor-mode-map "C-<" #'switchy-window)

;; Or as a substitute for `other-window'.
(defun my-switchy-window-set-or-unset-key ()
  (if switchy-window-minor-mode
      (keymap-global-set "<remap> <other-window>"
                         #'switchy-window)
    (keymap-global-unset "<remap> <other-window>")))

(add-hook 'switchy-window-minor-mode-hook
          #'my-switchy-window-set-or-unset-key)
(keymap-set switchy-window-minor-mode-map
            "<remap> <other-window>" #'switchy-window)
```

**Hint**: Since the order of window switching is not as obvious as it is with


@@ 60,8 54,11 @@ install it simply from `M-x list-packages RET` or using `use-package` like so:
(use-package switchy-window
  :ensure t
  :custom (switchy-window-delay 1.5) ;; That's the default value.
  :bind   (:map switchy-window-minor-mode-map
                ("C-<" . switchy-window))
  :bind     :bind (:map switchy-window-minor-mode-map
                        ;; Bind to separate key...
                        ("C-<" . switchy-window)
                        ;; ...or as `other-key' substitute (C-x o).
                        ("<remap> <other-window>" . switchy-window))
  :init
  (switchy-window-minor-mode))
```

M switchy-window.el => switchy-window.el +3 -9
@@ 3,7 3,7 @@
;; Copyright (C) 2023 Free Software Foundation, Inc
;;
;; Author: Tassilo Horn <tsdh@gnu.org>
;; Version: 1.2
;; Version: 1.3
;; Keywords: windows
;; Homepage: https://sr.ht/~tsdh/switchy-window/
;; Repository: https://git.sr.ht/~tsdh/switchy-window


@@ 112,14 112,8 @@ No keys are bound by default.  Bind the main command
  (keymap-set switchy-window-minor-mode-map \"C-<\" #\\='switchy-window)

  ;; Or as a substitute for `other-window'.
  (defun my-switchy-window-set-or-unset-key ()
    (if switchy-window-minor-mode
        (keymap-global-set \"<remap> <other-window>\"
                           #\\='switchy-window)
      (keymap-global-unset \"<remap> <other-window>\")))

  (add-hook \\='switchy-window-minor-mode-hook
            #\\='my-switchy-window-set-or-unset-key)")
  (keymap-set switchy-window-minor-mode-map
              \"<remap> <other-window>\" #\\='switchy-window)")

;;;###autoload
(define-minor-mode switchy-window-minor-mode