From cbd21d7fa11b46934f4503737c58be00d0eee4f2 Mon Sep 17 00:00:00 2001 From: Pierre Neidhardt Date: Sat, 24 Jun 2017 10:04:05 +0100 Subject: [PATCH] Emacs: Evil: Use evil-commentary --- .emacs.d/init.el | 2 +- .emacs.d/lisp/init-evil.el | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.emacs.d/init.el b/.emacs.d/init.el index b7056054..5e319750 100644 --- a/.emacs.d/init.el +++ b/.emacs.d/init.el @@ -94,7 +94,7 @@ (setq emms-directory (concat emacs-cache-folder "emms")) ;;; Evil -(nconc package-selected-packages '(evil evil-leader evil-ediff evil-magit evil-mc evil-mc-extras linum-relative)) +(nconc package-selected-packages '(evil evil-commentary evil-leader evil-ediff evil-magit evil-mc evil-mc-extras linum-relative)) (when (require 'evil nil t) (require 'init-evil)) ;;; Eshell diff --git a/.emacs.d/lisp/init-evil.el b/.emacs.d/lisp/init-evil.el index 639e0308..384113fc 100644 --- a/.emacs.d/lisp/init-evil.el +++ b/.emacs.d/lisp/init-evil.el @@ -7,11 +7,6 @@ ;; - Navigating through the marks randomly produces a "Marker points into wrong buffer" error. ;; https://github.com/emacs-evil/evil/issues/845#issuecomment-306050231 -;; TODO: M-; comments next line in VISUAL. This is because of a different -;; newline definition between Emacs and Vim. -;; https://github.com/redguardtoo/evil-nerd-commenter: Not so different, cannot -;; comment up without M--. - ;; Several packages handle relative line numbering: ;; - nlinum-relative: Seems slow as of May 2017. ;; - linum-relative: integrates well but not with fringe string, must be a function. @@ -33,6 +28,14 @@ (evil-mode 1) +;; Comments +;; M-; comments next line in VISUAL. This is because of a different newline +;; definition between Emacs and Vim. +;; https://github.com/redguardtoo/evil-nerd-commenter: does not work well with +;; motions and text objects, e.g. it cannot comment up without M--. +;; `evil-commentary' is the way to go. +(evil-commentary-mode) + (defun eshell-or-new-session (&optional arg) "Create an interactive Eshell buffer. If there is already an Eshell session active, switch to it.