Function: evil-window-exchange

evil-window-exchange is an interactive and byte-compiled function defined in evil-commands.el.

Signature

(evil-window-exchange &optional COUNT)

Documentation

Exchange the current window with the next, or the COUNT-th, one.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-commands.el
(evil-define-command evil-window-exchange (&optional count)
  "Exchange the current window with the next, or the COUNT-th, one."
  :repeat nil
  (interactive "<wc>")
  (let ((original-window (selected-window)))
    (evil-window-next count)
    (if (fboundp 'window-swap-states)
        (window-swap-states nil original-window t)
      (let* ((other-window (selected-window))
             (original-state (window-state-get original-window))
             (other-state (window-state-get other-window)))
        (window-state-put other-state original-window t)
        (window-state-put original-state other-window t)))))