From 02f5429c4471601f7ae0715fe0fde0bf01dac9d9 Mon Sep 17 00:00:00 2001 From: Valentin Gehrke Date: Fri, 13 Oct 2017 22:50:50 +0200 Subject: [PATCH] emacs - some polish --- emacs/.emacs.d/init.el | 24 ++++++++++++++++++++++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/emacs/.emacs.d/init.el b/emacs/.emacs.d/init.el index a96c4cd..36bd2e5 100644 --- a/emacs/.emacs.d/init.el +++ b/emacs/.emacs.d/init.el @@ -35,7 +35,7 @@ (defun silence () (interactive)) -;; Disable backup +;; Enable backup (setq make-backup-files t) (setq version-control t @@ -45,6 +45,15 @@ kept-new-versions 6 kept-old-versions 2) +;; Scroll behaviour +(setq + scroll-step 1 + scroll-margin 5 + scroll-conservatively 9999) + +;; Auto-fill in text +(add-hook 'text-mode-hook 'turn-on-auto-fill) +(setq-default fill-column 80) (push '("melpa" . "http://melpa.milkbox.net/packages/") package-archives) @@ -222,6 +231,13 @@ (interactive) (kill-buffer (current-buffer))) +(defun my/kill-window () + "Closes current window if not last" + (interactive) + (if (one-window-p (selected-window)) + (message "Last window, won't kill") + (delete-window (selected-window)))) + (use-package evil :ensure t :demand t @@ -229,7 +245,11 @@ (evil-mode 1) (setq evil-ex-substitute-global t) (define-key evil-normal-state-map "/" 'swiper) - (evil-ex-define-cmd "q" 'my/kill-current-buffer) + (evil-ex-define-cmd "q" 'my/kill-window) + (evil-ex-define-cmd "wq" (lambda () + (interactive) + (save-buffer) + (my/kill-window))) (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)