From c8314038a2f9ab94c1761f5a9642d842ec345a23 Mon Sep 17 00:00:00 2001 From: Valentin Gehrke Date: Sat, 14 Oct 2017 01:18:46 +0200 Subject: [PATCH] emacs - modification for my/kill-window-or-buffer --- emacs/.emacs.d/init.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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)