Skip to content

Commit df84837

Browse files
committed
Refactor evil-window-exchange
1 parent a941e89 commit df84837

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

evil-commands.el

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4560,20 +4560,18 @@ If ARG is empty, maximize the current window height."
45604560
With COUNT: Exchange current window with COUNTth window."
45614561
:repeat nil
45624562
(interactive "<c>")
4563-
(let ((this-buffer (window-buffer)))
4563+
(let ((this-buffer (window-buffer))
4564+
other-buffer other-window)
45644565
(if (not count)
4565-
(let ((next-buffer (window-buffer (next-window))))
4566-
(switch-to-buffer next-buffer nil t)
4567-
(select-window (next-window))
4568-
(switch-to-buffer this-buffer nil t))
4569-
(let (other-window other-buffer)
4570-
(save-window-excursion
4571-
(evil-window-next count)
4572-
(setq other-window (selected-window)
4573-
other-buffer (window-buffer)))
4574-
(switch-to-buffer other-buffer nil t)
4575-
(select-window other-window)
4576-
(switch-to-buffer this-buffer nil t)))))
4566+
(setq other-buffer (window-buffer (next-window))
4567+
other-window (next-window))
4568+
(save-window-excursion
4569+
(evil-window-next count)
4570+
(setq other-buffer (window-buffer)
4571+
other-window (selected-window))))
4572+
(switch-to-buffer other-buffer nil t)
4573+
(select-window other-window)
4574+
(switch-to-buffer this-buffer nil t)))
45774575

45784576
(evil-define-command evil-window-move-very-top ()
45794577
"Closes the current window, splits the upper-left one horizontally

0 commit comments

Comments
 (0)