2

I use evil and evil-tabs with Emacs and am quite comfortable with my setup except a few times when I have multiple splits open in a tab, using :q ends up closing all the splits in the window. In Vim it will close only the split I am currently in.

I think this part of evil-tabs.el is responsible:

(evil-define-command evil-tab-sensitive-quit (&optional bang)
  :repeat nil
  (interactive "<!>")
  (if (> (length (elscreen-get-screen-list)) 1)
    (elscreen-kill)
    (evil-quit bang)))
(evil-ex-define-cmd "q[uit]" 'evil-tab-sensitive-quit)

I tried doing the following in my .emacs:

;;; `:quit` ends up quitting more than I intended. So rebind that.
(evil-ex-define-cmd "q[uit]" 'kill-buffer-and-window)

Also:

(eval-after-load 'evil-tabs
  ;; `:quit` ends up quitting more than I intended. So rebind that.
  '(evil-ex-define-cmd "q[uit]" 'kill-buffer-and-window))

But :q again closes the whole tab. Any clues on how to change or debug this?

1

I've submitted a pull request to fix this in the evil-tabs repo just now, so hopefully it will be applied soon. But in case it isn't or you don't want to wait (anyone coming here just now as I did) you can change evil-tab-sensitive-quit to be:

(evil-define-command evil-tab-sensitive-quit (&optional bang) :repeat nil (interactive "<!>") (if (> (length (elscreen-get-screen-list)) 1) (if (> (length (window-list)) 1) (evil-quit bang) (elscreen-kill) (evil-quit bang)) (evil-quit bang)))

The behavior is then:

if tab contains > 1 window, then :q will just close current window else close tab

and also

if last window in last remaining tab then :q will kill Emacs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.