emacs - modification for my/kill-window-or-buffer

This commit is contained in:
madmaurice 2017-10-14 01:18:46 +02:00
parent 0dab4eb051
commit c8314038a2

View file

@ -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)