diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index 81019f2..ada6a98 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -249,12 +249,12 @@ (interactive) (kill-buffer (current-buffer))) -(defun my/kill-window () +(defun my/kill-window-or-buffer () "Closes current window if not last" (interactive) (if (one-window-p (selected-window)) - (message "Last window, won't kill") - (delete-window (selected-window)))) + (kill-buffer (current-buffer)) ;; If last window, just kill buffer + (delete-window (selected-window)))) ;; else delete window (use-package evil :ensure t @@ -263,11 +263,11 @@ (evil-mode 1) (setq evil-ex-substitute-global t) (define-key evil-normal-state-map "/" 'swiper) - (evil-ex-define-cmd "q" 'my/kill-window) + (evil-ex-define-cmd "q" 'my/kill-window-or-buffer) (evil-ex-define-cmd "wq" (lambda () (interactive) (save-buffer) - (my/kill-window))) + (my/kill-window-or-buffer))) (define-key evil-normal-state-map "gb" 'my/evil-go-back) (define-key evil-normal-state-map "gn" 'my/evil-go-forward) (define-key evil-motion-state-map [down-mouse-1] 'silence)