aboutsummaryrefslogtreecommitdiff
path: root/evil-commands.el
diff options
context:
space:
mode:
authorAnkit Pandey <anpandey@protonmail.com>2023-04-08 20:41:16 -0700
committerTom Dalziel <33435574+tomdl89@users.noreply.github.com>2023-04-10 18:36:56 -0600
commit9bbebe05d490b0c54cffb07e4bc60ee6f3833773 (patch)
tree7f0755f17d682b99def5b406062034d5f59bc6da /evil-commands.el
parentde07e9a59231d280166c03e05407dcc1e5aed112 (diff)
evil-window-delete: Attempt to close tab if tab bar is enabled
Diffstat (limited to 'evil-commands.el')
-rw-r--r--evil-commands.el10
1 files changed, 8 insertions, 2 deletions
diff --git a/evil-commands.el b/evil-commands.el
index d44d3ab..82a9817 100644
--- a/evil-commands.el
+++ b/evil-commands.el
@@ -4398,11 +4398,17 @@ This is equivalent to Vim's alternate buffer."
(switch-to-buffer (car previous-place)))))
(evil-define-command evil-window-delete ()
- "Delete the current window.
+ "Delete the current window or tab.
If `evil-auto-balance-windows' is non-nil then all children of
the deleted window's parent window are rebalanced."
(let ((p (window-parent)))
- (delete-window)
+ ;; If tabs are enabled and this is the only visible window, then attempt to
+ ;; close this tab.
+ (if (and (boundp 'tab-bar-mode)
+ tab-bar-mode
+ (not p))
+ (tab-close)
+ (delete-window))
(when evil-auto-balance-windows
;; balance-windows raises an error if the parent does not have
;; any further children (then rebalancing is not necessary anyway)