Function: evil-move-window

evil-move-window is a byte-compiled function defined in evil-commands.el.

Signature

(evil-move-window SIDE)

Documentation

Move the selected-window to SIDE.

The state of the selected-window is saved along with the state of the window tree consisting of all the other windows. Then, all windows are deleted, the remaining window is split according to SIDE, the state of the window at SIDE is replaced with the saved state of the selected-window, and, finally, the state of the saved window tree is reconstructed on the opposite side.

SIDE has the same meaning as in split-window.

Note, this function only operates on the window tree rooted in the frame's main window and effectively preserves any side windows (i.e. windows with a valid window-side window parameter).

Source Code

;; Defined in ~/.emacs.d/elpa/evil-20251108.138/evil-commands.el
(defun evil-move-window (side)
  "Move the `selected-window' to SIDE.
The state of the `selected-window' is saved along with the state
of the window tree consisting of all the other windows. Then, all
windows are deleted, the remaining window is split according to
SIDE, the state of the window at SIDE is replaced with the saved
state of the `selected-window', and, finally, the state of the
saved window tree is reconstructed on the opposite side.

SIDE has the same meaning as in `split-window'.

Note, this function only operates on the window tree rooted in
the frame's main window and effectively preserves any side
windows (i.e. windows with a valid window-side window
parameter)."
  (evil-save-side-windows
    (unless (one-window-p)
      (save-excursion
        (let ((w (window-state-get (selected-window))))
          (delete-window)
          (let ((wtree (window-state-get)))
            (delete-other-windows)
            (let ((subwin (selected-window))
                  ;; NOTE: SIDE is new in Emacs 24
                  (newwin (split-window nil nil side)))
              (window-state-put wtree subwin)
              (window-state-put w newwin)
              (select-window newwin)))))
      (balance-windows))))