summaryrefslogtreecommitdiff
path: root/.emacs.d/elpa/evil-nerd-commenter-20171206.441
diff options
context:
space:
mode:
Diffstat (limited to '.emacs.d/elpa/evil-nerd-commenter-20171206.441')
-rw-r--r--.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-autoloads.el110
-rw-r--r--.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-operator.el345
-rw-r--r--.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-pkg.el5
-rw-r--r--.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-sdk.el102
-rw-r--r--.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-sdk.elcbin2509 -> 0 bytes
-rw-r--r--.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter.el706
-rw-r--r--.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter.elcbin14514 -> 0 bytes
7 files changed, 0 insertions, 1268 deletions
diff --git a/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-autoloads.el b/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-autoloads.el
deleted file mode 100644
index cda1d9c..0000000
--- a/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-autoloads.el
+++ /dev/null
@@ -1,110 +0,0 @@
-;;; evil-nerd-commenter-autoloads.el --- automatically extracted autoloads
-;;
-;;; Code:
-(add-to-list 'load-path (directory-file-name (or (file-name-directory #$) (car load-path))))
-
-;;;### (autoloads nil "evil-nerd-commenter" "evil-nerd-commenter.el"
-;;;;;; (23088 9370 104154 633000))
-;;; Generated autoloads from evil-nerd-commenter.el
-
-(autoload 'evilnc-comment-or-uncomment-paragraphs "evil-nerd-commenter" "\
-Comment or uncomment NUM paragraph(s).
-A paragraph is a continuation non-empty lines.
-Paragraphs are separated by empty lines.
-
-\(fn &optional NUM)" t nil)
-
-(autoload 'evilnc-comment-or-uncomment-to-the-line "evil-nerd-commenter" "\
-Comment or uncomment from current line to LINENUM line.
-
-\(fn &optional LINENUM)" t nil)
-
-(autoload 'evilnc-quick-comment-or-uncomment-to-the-line "evil-nerd-commenter" "\
-Comment/uncomment to line number by last digit(s) whose value is UNITS.
-For exmaple, you can use either \\<M-53>\\[evilnc-quick-comment-or-uncomment-to-the-line] or \\<M-3>\\[evilnc-quick-comment-or-uncomment-to-the-line] to comment to the line 6453
-
-\(fn &optional UNITS)" t nil)
-
-(autoload 'evilnc-toggle-invert-comment-line-by-line "evil-nerd-commenter" "\
-Please note this command may NOT work on complex evil text objects.
-
-\(fn)" t nil)
-
-(autoload 'evilnc-toggle-comment-empty-lines "evil-nerd-commenter" "\
-Toggle the flag which decide wether empty line will be commented.
-
-\(fn)" t nil)
-
-(autoload 'evilnc-comment-or-uncomment-lines "evil-nerd-commenter" "\
-Comment or uncomment NUM lines. NUM could be negative.
-
-Case 1: If no region selected, comment/uncomment on current line.
-If NUM>1, comment/uncomment extra N-1 lines from next line.
-
-Case 2: Selected region is expanded to make it contain whole lines.
-Then we comment/uncomment the expanded region. NUM is ignored.
-
-Case 3: If a region inside of ONE line is selected,
-we comment/uncomment that region.
-CORRECT comment syntax will be used for C++/Java/Javascript.
-
-\(fn &optional NUM)" t nil)
-
-(autoload 'evilnc-copy-and-comment-lines "evil-nerd-commenter" "\
-Copy&paste NUM lines and comment out original lines.
-NUM could be negative.
-
-Case 1: If no region selected, operate on current line.
-if NUM>1, comment/uncomment extra N-1 lines from next line
-
-Case 2: Selected region is expanded to make it contain whole lines.
-Then we operate the expanded region. NUM is ignored.
-
-\(fn &optional NUM)" t nil)
-
-(autoload 'evilnc-comment-and-kill-ring-save "evil-nerd-commenter" "\
-Comment lines save origin lines into `kill-ring'.
-NUM could be negative.
-
-Case 1: If no region selected, operate on current line.
-;; if NUM>1, comment/uncomment extra N-1 lines from next line
-
-Case 2: Selected region is expanded to make it contain whole lines.
-Then we operate the expanded region. NUM is ignored.
-
-\(fn &optional NUM)" t nil)
-
-(autoload 'evilnc-copy-to-line "evil-nerd-commenter" "\
-Copy from current line to LINENUM line. For non-evil user only.
-
-\(fn &optional LINENUM)" t nil)
-
-(autoload 'evilnc-kill-to-line "evil-nerd-commenter" "\
-Kill from the current line to the LINENUM line. For non-evil user only.
-
-\(fn &optional LINENUM)" t nil)
-
-(autoload 'evilnc-version "evil-nerd-commenter" "\
-The version number.
-
-\(fn)" t nil)
-
-(autoload 'evilnc-default-hotkeys "evil-nerd-commenter" "\
-Setup the key bindings of evil-nerd-comment.
-If NO-EVIL-KEYBINDINGS is t, we don't define keybindings in EVIL.
-
-\(fn &optional NO-EVIL-KEYBINDINGS)" t nil)
-
-;;;***
-
-;;;### (autoloads nil nil ("evil-nerd-commenter-operator.el" "evil-nerd-commenter-pkg.el"
-;;;;;; "evil-nerd-commenter-sdk.el") (23088 9370 107487 967000))
-
-;;;***
-
-;; Local Variables:
-;; version-control: never
-;; no-byte-compile: t
-;; no-update-autoloads: t
-;; End:
-;;; evil-nerd-commenter-autoloads.el ends here
diff --git a/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-operator.el b/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-operator.el
deleted file mode 100644
index e473767..0000000
--- a/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-operator.el
+++ /dev/null
@@ -1,345 +0,0 @@
-;;; evil-nerd-commenter-operator.el --- Provides an evil operator for evil-nerd-commenter
-
-;; Copyright (C) 2013-2017, Chen Bin
-
-;; Author: Chen Bin <chenbin.sh@gmail.com>
-
-;; This file is not part of GNU Emacs.
-
-;;; License:
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program; if not, write to the Free Software
-;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-;;; Commentary:
-
-;; Provides operators for evil-mode.
-
-;;; Code:
-
-(require 'evil)
-(require 'evil-nerd-commenter-sdk)
-
-(defvar evilnc-c-style-comment-modes
- '(awk-mode
- c++-mode
- c-mode
- css-mode
- dart-mode
- ess-mode
- go-mode
- java-mode
- javascript-mode
- js-mode
- js2-mode
- perl-mode
- php-mode
- swift-mode
- web-mode)
- "Major modes using C comment syntax.")
-
-(defvar evilnc-temporary-goal-column 0
- "Value of`temporary-goal-column' specifying right edge of rectangle yank.")
-
-(defadvice evil-visual-highlight-block (around evil-visual-highlight-block-hack activate)
- "Show overlay over innert comment text object."
- ad-do-it
- (when (eq this-command 'evilnc-inner-comment)
- (dolist (overlay evil-visual-block-overlays)
- (let* ((b (overlay-start overlay))
- (e (save-excursion
- (goto-char (overlay-end overlay))
- (line-end-position))))
- (move-overlay overlay b e)))))
-
-(defadvice evil-apply-on-block (around evil-apply-on-block-around-hack activate)
- "Yank correct region of nner comment text object."
- (let* ((tmp-command last-command))
- ;; force `evil-apply-on-block' use our temporary-goal-column
- (when (> evilnc-temporary-goal-column 0)
- (setq temporary-goal-column (max temporary-goal-column
- evilnc-temporary-goal-column))
- ;; Read `evil-apply-on-block'. Note `temporary-goal-column' is used
- ;; if and only if `last-command' is `next-line' or `previous-line'
- (setq last-command 'next-line))
- ad-do-it
- ;; restore last command
- (setq last-command tmp-command)
- (setq evilnc-temporary-goal-column 0)))
-
-(defun evilnc--in-comment-p (pos)
- "Check whether the code at POS is comment by comparing font face."
- (interactive)
- (let* ((fontfaces (get-text-property pos 'face)))
- (if (not (listp fontfaces))
- (setf fontfaces (list fontfaces)))
- (delq nil
- (mapcar #'(lambda (f)
- ;; learn this trick from flyspell
- (or (eq f 'font-lock-comment-face)
- (eq f 'font-lock-comment-delimiter-face)))
- fontfaces))))
-
-(defun evilnc--extend-to-whole-comment (beg end)
- "Extend the comment region defined by BEG and END so ALL comment is included."
- (interactive)
- (if (evilnc--in-comment-p beg)
- (save-excursion
- (let* ((newbeg beg)
- (newend end))
-
- ;; extend the beginning
- (goto-char newbeg)
- (while (and (>= newbeg (line-beginning-position)) (evilnc--in-comment-p newbeg))
- (setq newbeg (1- newbeg)))
-
- ;; make sure newbeg is at the beginning of the comment
- (if (< newbeg beg) (setq newbeg (1+ newbeg)))
-
- ;; extend the end
- (goto-char newend)
- (while (and (<= newend (line-end-position)) (evilnc--in-comment-p newend))
- (setq newend (1+ newend)))
- ;; make sure newend is at the end of the comment
- (if (> newend end) (setq newend (evilnc-get-comment-end newend)))
-
- (list newbeg newend)))
- (list beg end)))
-
-(evil-define-operator evilnc-comment-operator (beg end type)
- "Comments text from BEG to END with TYPE."
- (interactive "<R>")
- (cond
- ((eq type 'block)
- (let* ((newpos (evilnc--extend-to-whole-comment beg end) ))
- (evil-apply-on-block #'evilnc--comment-or-uncomment-region
- (nth 0 newpos)
- (nth 1 newpos)
- nil)))
- ((and (eq type 'line)
- (= end (point-max))
- (or (= beg end)
- (/= (char-before end) ?\n))
- (/= beg (point-min))
- (= (char-before beg) ?\n))
- (evilnc--comment-or-uncomment-region (1- beg) end))
-
- ((eq type 'line)
- (evilnc--comment-or-uncomment-region beg (evilnc-get-comment-end end)))
-
- (t
- (let* ((newpos (evilnc--extend-to-whole-comment beg end) ))
- (evilnc--comment-or-uncomment-region (nth 0 newpos) (nth 1 newpos)))))
-
- ;; place cursor on beginning of line
- (if (and (called-interactively-p 'any)
- (eq type 'line))
- (evil-first-non-blank)))
-
-(evil-define-operator evilnc-copy-and-comment-operator (beg end)
- "Inserts an out commented copy of the text from BEG to END."
- :move-point (not evilnc-original-above-comment-when-copy-and-comment)
- (interactive "<r>")
- (evil-yank-lines beg end nil 'lines)
- (cond
- (evilnc-original-above-comment-when-copy-and-comment
- (let* ((p (point)))
- (comment-region beg end)
- (goto-char beg)
- (evil-paste-before 1)
- (goto-char p)))
- (t
- (goto-char end)
- (evil-paste-before 1)
- ;; actual comment operatio should happen at last
- ;; or else beg end will be screwed up
- (comment-region beg end))))
-
-(defun evilnc-is-one-line-comment (b e)
- "Check whether text between B and E is one line comment."
- (save-excursion
- (goto-char b)
- (and (<= (line-beginning-position) b)
- ;; e is the upper limit great than (line-end-position)
- (<= e (1+ (line-end-position))))))
-
-(defun evilnc-get-comment-bounds ()
- "Return bounds like (cons beg end)."
- (let* ((b (point))
- (e (point))
- (col 0)
- rlt)
- ;; extend begin
- (while (evilnc-is-comment (- b 1))
- (setq b (- b 1)))
-
- ;; extend end
- (while (evilnc-is-comment (+ e 1))
- (setq e (+ e 1)))
-
- ;; we could select extra spaces at the end of comment
- ;; so we need go back
- (let* ((str (save-excursion
- (goto-char e)
- (buffer-substring-no-properties (line-beginning-position) e)))
- (empty-line-p (string-match "^[ \t]*$" str)))
- (if empty-line-p
- ;; empty line plus line feed
- (setq e (- e (length str) 1))))
- (cond
- ((>= b e)
- (setq rlt nil))
- ((evilnc-is-one-line-comment b e)
- ;; contract begin
- (while (not (evilnc-is-pure-comment b))
- (setq b (+ b 1)))
-
- ;; contract end
- (while (not (evilnc-is-pure-comment e))
- (setq e (- e 1)))
-
- (if (< b e) (setq rlt (cons b (+ e 1)))))
- (t
- ;; multi-line comment
- (setq rlt (cons b e))))
- rlt))
-
-(defun evilnc-adjusted-comment-end (b e)
- "Ajust comment end of region between B and E."
- (let* ((next-end-char (evilnc-get-char (- e 2)))
- (end-char (evilnc-get-char (- e 1))))
- ;; avoid selecting CR/LF at the end of comment
- (while (and (< b e)
- (memq (evilnc-get-char (- e 1)) '(10 13)))
- (setq e (- e 1)))
-
- ;; avoid selecting comment limiter
- (cond
- ((and (memq major-mode evilnc-c-style-comment-modes)
- (= end-char ?/)
- (= next-end-char ?*))
- ;; avoid selecting the ending comment limiter "*/"
- (setq e (- e 2))
- (while (and (> e b)
- (= (evilnc-get-char (- e 1)) ?*))
- (setq e (- e 1))))
- (t
- ;; other languages we can safely use font face
- (while (and (> e b)
- (evilnc-is-comment-delimiter (- e 1)))
- (setq e (- e 1)))))
- e))
-
-(defun evilnc-is-c-style-comment (pos)
- "Is C style comment at POS?"
- (and (memq major-mode evilnc-c-style-comment-modes)
- (= (evilnc-get-char pos) ?/)
- (= (memq (evilnc-get-char (1+ pos)) '(?/ ?*)))))
-
-(defun evilnc-comment-column-bounds (beg end &optional c-style)
- "From BEG to END find column bounds of rectangle selection.
-Return (cons col-min col-max) or nil. If C-STYLE is t,
-we are processing C like language."
- (let* ((col-min most-positive-fixnum)
- (col-max 0))
- (while (< beg end)
- (when (and (not (evilnc-is-whitespace beg))
- (evilnc-is-pure-comment beg)
- (not (or (evilnc-is-comment-delimiter beg)
- (and c-style
- (memq (evilnc-get-char beg) '(?/ ?*))))))
- (let* ((col (evil-column beg)))
- (if (< col col-min)
- (setq col-min col))
- (if (> col col-max)
- (setq col-max col))))
- (setq beg (1+ beg)))
- (if (< col-min col-max)
- (cons col-min col-max))))
-
-(evil-define-text-object evilnc-inner-comment (&optional count begin end type)
- "An inner comment text object."
- (let* ((bounds (evilnc-get-comment-bounds))
- b
- e
- c-style)
- (cond
- (bounds
- (setq b (car bounds))
- (setq e (cdr bounds))
- (cond
- ((setq c-style (evilnc-is-c-style-comment b))
- (while (and (< b e)
- (or (evilnc-is-whitespace b)
- (evilnc-is-line-end b)
- (memq (evilnc-get-char b) '(?/ ?*))))
- (setq b (1+ b)))
- (while (and (< b e)
- (or (evilnc-is-whitespace e)
- (evilnc-is-line-end e)
- (memq (evilnc-get-char e) '(?/ ?*))))
- (setq e (1- e)))
- (setq e (1+ e))
- (setq b (save-excursion
- (goto-char b)
- (forward-word 1)
- (forward-word -1)
- (point))))
- (t
- (setq b (save-excursion
- (goto-char (car bounds))
- (forward-word 1)
- (forward-word -1)
- (point)))
- (setq e (save-excursion
- (goto-char (cdr bounds))
- (goto-char (evilnc-adjusted-comment-end b (line-end-position)))
- (point)))))
- (cond
- ((evilnc-is-one-line-comment b e)
- ;; keep move e to the end of comment
- (evil-range b ;; (if c-style (1+ e) e)
- e))
- (t
- ;; multi-line comment
- (let* ((col-b (evil-column b))
- (col-bounds (evilnc-comment-column-bounds b e c-style)))
- (cond
- (col-bounds
- (if (> col-b (car col-bounds))
- (setq b (- b (- col-b (car col-bounds)))))
- (setq evilnc-temporary-goal-column (cdr col-bounds)))
- (t
- (setq evilnc-temporary-goal-column (evil-column e)))))
- (evil-range b e 'block :expanded t))))
- (t
- (error "Not inside a comment")))))
-
-(evil-define-text-object evilnc-outer-commenter (&optional count begin end type)
- "An outer comment text object."
- (let* ((bounds (evilnc-get-comment-bounds)))
- (cond
- (bounds
- (let* ((b (car bounds))
- (e (cdr bounds)))
- (evil-range b e 'exclusive :expanded t)))
- (t
- (error "Not inside a comment")))))
-
-(provide 'evil-nerd-commenter-operator)
-;;; evil-nerd-commenter-operator.el ends here
-
-;; Local Variables:
-;; no-byte-compile: t
-;; End:
diff --git a/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-pkg.el b/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-pkg.el
deleted file mode 100644
index 7f3f6ae..0000000
--- a/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-pkg.el
+++ /dev/null
@@ -1,5 +0,0 @@
-(define-package "evil-nerd-commenter" "20171206.441" "Comment/uncomment lines efficiently. Like Nerd Commenter in Vim" 'nil :url "http://github.com/redguardtoo/evil-nerd-commenter" :keywords
- '("commenter" "vim" "line" "evil"))
-;; Local Variables:
-;; no-byte-compile: t
-;; End:
diff --git a/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-sdk.el b/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-sdk.el
deleted file mode 100644
index 1e85513..0000000
--- a/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-sdk.el
+++ /dev/null
@@ -1,102 +0,0 @@
-;;; evil-nerd-commenter-sdk.el --- SDK used by other files
-
-;; Copyright (C) 2017 Chen Bin
-
-;; Author: Chen Bin <chenin DOT sh AT gmail DOT com>
-
-;;; License:
-
-;; This file is not part of GNU Emacs.
-
-;; This program is free software; you can redistribute it and/or modify
-;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
-
-;; This program is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-
-;; You should have received a copy of the GNU General Public License
-;; along with this program; if not, write to the Free Software
-;; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-;;; Commentary:
-;; SDK used internally
-
-;;; Code:
-
-(defun evilnc--check-fonts (fonts-under-cursor fonts-list)
- "Check whether FONTS-UNDER-CURSOR among FONTS-LIST."
- (delq nil
- (mapcar #'(lambda (f)
- ;; learn this trick from flyspell
- (member f fonts-list))
- fonts-under-cursor)))
-
-(defun evilnc-web-mode-is-comment (&optional pos)
- "Check whether the code at POS is comment.
-`web-mode' removes its API, so create our own."
- (unless pos (setq pos (point)))
- (not (null (or (eq (get-text-property pos 'tag-type) 'comment)
- (eq (get-text-property pos 'block-token) 'comment)
- (eq (get-text-property pos 'part-token) 'comment)))))
-
-(defun evilnc-is-pure-comment (pos)
- "Check character at POS is pure comment."
- (let* ((fontfaces (if (> pos 0) (get-text-property pos 'face))))
- (if (not (listp fontfaces))
- (setf fontfaces (list fontfaces)))
- (or (and (string= major-mode "web-mode")
- (evilnc-web-mode-is-comment pos))
- (evilnc--check-fonts fontfaces
- '(font-lock-comment-face
- font-lock-comment-delimiter-face)))))
-
-(defun evilnc-is-whitespace (pos)
- "Character at POS is white space."
- (member (evilnc-get-char pos) '(32 9)))
-
-(defun evilnc-is-line-end (pos)
- "Character at POS is line end."
- (member (evilnc-get-char pos) '(10 11)))
-
-(defun evilnc-get-comment-end (end)
- (if (= end (point-max)) end (1- end)))
-
-(defun evilnc-is-comment (pos)
- "Check whether the code at POS is comment by comparing font face.
-Please note the white spaces out of comment is treated as comment,
-or else we can't select multiple lines comment."
- (let* ((fontfaces (if (> pos 0) (get-text-property pos 'face))))
- (if (not (listp fontfaces))
- (setf fontfaces (list fontfaces)))
- (cond
- ((or (< pos (point-min)) (> pos (point-max)))
- nil)
- ((not fontfaces)
- ;; character under cursor is SPACE or TAB
- ;; and out of comment
- (evilnc-is-whitespace pos))
- (t
- (evilnc-is-pure-comment pos)))))
-
-(defun evilnc-get-char (pos)
- "Get character at POS."
- (save-excursion
- (goto-char pos)
- (following-char)))
-
-(defun evilnc-is-comment-delimiter (pos)
- "Is character at POS a comment delimiter?"
- (let* ((fontfaces (if (> pos 0) (get-text-property pos 'face))))
- (if (not (listp fontfaces))
- (setf fontfaces (list fontfaces)))
- (and fontfaces
- (evilnc--check-fonts fontfaces
- '(font-lock-comment-delimiter-face)))))
-
-(provide 'evil-nerd-commenter-sdk)
-;;; evil-nerd-commenter-sdk.el ends here
-
diff --git a/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-sdk.elc b/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-sdk.elc
deleted file mode 100644
index 3804896..0000000
--- a/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter-sdk.elc
+++ /dev/null
Binary files differ
diff --git a/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter.el b/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter.el
deleted file mode 100644
index 51f7568..0000000
--- a/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter.el
+++ /dev/null
@@ -1,706 +0,0 @@
-;;; evil-nerd-commenter.el --- Comment/uncomment lines efficiently. Like Nerd Commenter in Vim
-
-;; Copyright (C) 2013-2017, Chen Bin
-
-;; Author: Chen Bin <chenbin.sh@gmail.com>
-;; URL: http://github.com/redguardtoo/evil-nerd-commenter
-;; Version: 3.1.3
-;; Keywords: commenter vim line evil
-;;
-;; This file is not part of GNU Emacs.
-
-;;; Credits:
-
-;; - Lally Oppenheimer added the support for text-object in Evil
-;; - Tom Willemse provided the fix to make Emacs 24.4 work
-
-;;; License:
-
-;; This file is part of evil-nerd-commenter
-;;
-;; evil-nerd-commenter is free software: you can redistribute it and/or
-;; modify it under the terms of the GNU General Public License as published
-;; by the Free Software Foundation, either version 3 of the License, or
-;; (at your option) any later version.
-;;
-;; evil-nerd-commenter is distributed in the hope that it will be useful,
-;; but WITHOUT ANY WARRANTY; without even the implied warranty of
-;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-;; GNU General Public License for more details.
-;;
-;; You should have received a copy of the GNU General Public License
-;; along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-;;; Commentary:
-
-;;
-;; This program emulates nerd-commenter.vim by Marty Grenfell.
-;;
-;; It helps you comment/uncomment multiple lines without selecting them.
-;;
-;; `M-x evilnc-default-hotkeys` assigns hotkey `M-;` to
-;; `evilnc-comment-or-uncomment-lines'
-;;
-;; `M-x evilnc-comment-or-uncomment-lines` comment or uncomment lines.
-;;
-;; `M-x evilnc-quick-comment-or-uncomment-to-the-line` will comment/uncomment
-;; from current line to specified line.
-;; The last digit(s) of line number is parameter of the command.
-;;
-;; For example, `C-u 9 evilnc-quick-comment-or-uncomment-to-the-line` comments
-;; code from current line to line 99 if you current line is 91.
-;;
-;; Though this program could be used *independently*, though I highly recommend
-;; using it with Evil (https://bitbucket.org/lyro/evil/)
-;;
-;; Evil makes you take advantage of power of Vi to comment lines.
-;; For example, you can press key `99,ci` to comment out 99 lines.
-;;
-;; Setup:
-;;
-;; If comma is your leader key, as most Vim users do, setup is one liner,
-;; (evilnc-default-hotkeys)
-;;
-;; If you use evil-leader and its default leader key,
-;; insert below setup into your ~/.emacs instead,
-;;
-;; (global-set-key (kbd "M-;") 'evilnc-comment-or-uncomment-lines)
-;;
-;; (require 'evil-leader)
-;; (global-evil-leader-mode)
-;; (evil-leader/set-key
-;; "ci" 'evilnc-comment-or-uncomment-lines
-;; "cl" 'evilnc-quick-comment-or-uncomment-to-the-line
-;; "ll" 'evilnc-quick-comment-or-uncomment-to-the-line
-;; ;; Or use `evilnc-comment-and-kill-ring-save' instead
-;; "cc" 'evilnc-copy-and-comment-lines
-;; "cp" 'evilnc-comment-or-uncomment-paragraphs
-;; "cr" 'comment-or-uncomment-region
-;; "cv" 'evilnc-toggle-invert-comment-line-by-line
-;; "." 'evilnc-copy-and-comment-operator
-;; "\\" 'evilnc-comment-operator)
-;;
-;; You can setup `evilnc-original-above-comment-when-copy-and-comment'
-;; to decide which style to use when `evilnc-copy-and-comment-lines'
-;; or `evilnc-copy-and-comment-operator',
-;; - Place the commented out text above original text
-;; - Or place the original text above commented out text
-;;
-;; We defined comment text object "c" which can have multi-lines.
-;; Press "vac" to select outer object (comment with limiters).
-;; Press "vic" to select inner object (comment without limiter).
-;;
-;; You can assign other key instead of "c" to the text object by
-;; customizing `evilnc-comment-text-object'.
-
-;; For certain major modes, you need manual setup to override its original
-;; keybindings,
-;;
-;; (defun matlab-mode-hook-config ()
-;; (local-set-key (kbd "M-;") 'evilnc-comment-or-uncomment-lines))
-;; (add-hook 'matlab-mode-hook 'matlab-mode-hook-config)
-;;
-;; See https://github.com/redguardtoo/evil-nerd-commenter for detail.
-;;
-;;; Code:
-
-(require 'evil-nerd-commenter-sdk)
-
-(autoload 'count-lines "simple")
-
-(defvar evilnc-original-above-comment-when-copy-and-comment nil
- "Keep the original text above the commented copy, when using either:
-`evilnc-copy-and-comment-lines' or `evilnc-copy-and-comment-operator'.")
-
-(defvar evilnc-invert-comment-line-by-line nil
- "If t then invert region comment status line by line.
-Please note it has NOT effect on evil text object!")
-
-(defvar evilnc-comment-both-snippet-html nil
- "Comment both embedded snippet and HTML tag if they are mixed in one line.
-`web-mode' required.")
-
-(defvar evilnc-comment-text-object "c"
- "The comment object.
-`vic` to select inner object.
-`vac` to select outer object.")
-
-(defun evilnc--count-lines (beg end)
- "Assume BEG is less than END."
- (let* ((rlt (count-lines beg end)))
- (save-excursion
- (goto-char beg)
- (if (> beg (line-beginning-position))
- (setq rlt (1+ rlt))))
- rlt))
-
-(defun evilnc--goto-line (line-num)
- "Shamelessly copied from `goto-line'. Goto line with LINE-NUM."
- (save-restriction
- (widen)
- (goto-char (point-min))
- (if (eq selective-display t)
- (re-search-forward "[\n\C-m]" nil 'end (1- line-num))
- (forward-line (1- line-num)))))
-
-(defun evilnc--fix-buggy-major-modes ()
- "Fix major modes whose comment regex is buggy.
-See http://lists.gnu.org/archive/html/bug-gnu-emacs/2013-03/msg00891.html."
- (cond
- ((eq major-mode 'autoconf-mode)
- ;; since comment-use-syntax is nil in autoconf.el, the comment-start-skip need
- ;; make sure its first parenthesized expression match the string exactly before
- ;; the "dnl", check the comment-start-skip in lisp-mode for sample.
- ;; See code in (defun comment-search-forward) from emacs 24.2:
- ;; (if (not comment-use-syntax)
- ;; (if (re-search-forward comment-start-skip limit noerror)
- ;; (or (match-end 1) (match-beginning 0)))
- ;; (do-something))
- ;; My regex makes sure (match-end 1) return the position of comment starter
- (if (and (boundp 'comment-use-syntax) (not comment-use-syntax))
- ;; Maybe autoconf.el will (setq comment-use-syntax t) in the future?
- (setq comment-start-skip "^\\(\\s*\\)\\(dnl\\|#\\) +"))
- )
- ((eq major-mode 'haml-mode)
- (setq comment-use-syntax nil)
- (setq comment-start "-# ")
- (setq comment-start-skip "-##*[ \t]*"))))
-
-(defun evilnc--operation-on-lines-or-region (fn &optional num)
- "Apply FN on NUM lines or selected region."
- (cond
- ;; NO region is selected
- ((not (region-active-p))
- (let* ((b (line-beginning-position)) e)
- (save-excursion
- (forward-line (- num 1))
- (setq e (line-end-position)))
- (funcall fn b e)))
-
- ;; Select region inside ONE line
- ((and (<= (line-beginning-position) (region-beginning))
- (<= (region-end) (line-end-position)))
- (cond
- ;; Well, looks current comment syntax is NOT fit for comment out a region.
- ;; So we also need hack the comment-start and comment-end
- ((and (string= "" comment-end)
- (member major-mode '(java-mode
- javascript-mode
- js-mode
- js2-mode
- js3-mode
- rjsx-mode
- c++-mode
- objc-mode)))
- (let* ((comment-start-old comment-start)
- (comment-end-old comment-end)
- (comment-start-skip-old comment-start-skip)
- (comment-end-skip-old comment-end-skip))
-
- ;; use C comment syntax temporarily
- (setq comment-start "/* ")
- (setq comment-end " */")
- (setq comment-start-skip "\\(//+\\|/\\*+\\)\\s *")
- (setq comment-end-skip "[ ]*\\(\\s>\\|\\*+/\\)")
-
- (funcall fn (region-beginning) (region-end))
-
- ;; Restore the original comment syntax
- (setq comment-start comment-start-old)
- (setq comment-end comment-end-old)
- (setq comment-start-skip comment-start-skip-old)
- (setq comment-end-skip comment-end-skip-old)))
- ;; just comment out the region
- (t (funcall fn (region-beginning) (region-end)))))
-
- ;; Select more than one line
- (t
- ;; selected region spans MORE than one line
- (save-excursion
- (let* ((b (region-beginning))
- (e (region-end)))
- ;; Another work around for evil-visual-line bug:
- ;; In evil-mode, if we use hotkey V or `M-x evil-visual-line` to select line,
- ;; the (line-beginning-position) of the line which is after the last selected
- ;; line is always (region-end)! Don't know why.
- (if (and (> e b)
- (save-excursion (goto-char e) (= e (line-beginning-position)))
- (boundp 'evil-state) (eq evil-state 'visual))
- (setq e (1- e)))
-
- (goto-char b)
- (setq b (line-beginning-position))
- (goto-char e)
- (setq e (line-end-position))
- (funcall fn b e))))))
-
-(defun evilnc--get-one-paragraph-region ()
- "Select a paragraph which has NO empty line."
- (let* (b e)
- (save-excursion
- (if (setq b (re-search-backward "^[ \t]*$" nil t))
- (progn
- (forward-line)
- (setq b (line-beginning-position)))
- (setq b 1)))
- (save-excursion
- (if (setq e (re-search-forward "^[ \t]*$" nil t))
- (progn
- (forward-line -1)
- (setq e (line-end-position)))
- (setq e (point-max))))
- (list b e)))
-
-(defun evilnc--invert-comment (beg end)
- "Scan the region from BEG to END line by line, invert its comment status."
- (let* (done b e)
- (save-excursion
- (goto-char end)
- (while (not done)
- (setq b (line-beginning-position))
- (setq e (line-end-position))
- (funcall (if (comment-only-p b e)
- 'uncomment-region 'comment-region)
- b e)
-
- (forward-line -1)
- (if (or (= (line-beginning-position) b)
- (< (line-end-position) beg))
- (setq done t))))))
-
-(defvar org-src-lang-modes)
-(declare-function org-show-subtree "org")
-(declare-function outline-up-heading "outline")
-
-(defun evilnc--working-on-region (beg end fn)
- "Region from BEG to END is applied with operation FN.
-Code snippets embedded in Org-mode is identified and right `major-mode' is used."
- (let* (pos
- info
- lang
- lang-f
- old-flag)
- (when (and (eq major-mode 'org-mode)
- (fboundp 'org-edit-src-find-region-and-lang))
- (setq info (org-edit-src-find-region-and-lang)))
-
- (when info
- (setq lang (or (cdr (assoc (nth 2 info) org-src-lang-modes))
- (nth 2 info)))
- (setq lang (if (symbolp lang) (symbol-name lang) lang))
- (setq lang-f (intern (concat lang "-mode"))))
-
- ;; turn on 3rd party language's major-mode temporarily
- (if lang-f (funcall lang-f))
-
- (if evilnc-invert-comment-line-by-line
- (evilnc--invert-comment beg end)
- (setq pos (point))
- (funcall fn beg end)
- (goto-char pos))
-
- ;; turn off 3rd party language's major-mode temporarily and clean the shit
- (when lang-f
- ;; avoid org file automatically collapsed
- (setq pos (point))
- (org-mode)
- ;; just goto the root element
- (condition-case nil
- (outline-up-heading 1)
- (error
- (message "in the beginning ...")))
- ;; expand current node because by default (org-mode) will collapse all nodes
- (org-show-subtree)
- (goto-char pos))))
-
-(declare-function web-mode-comment-or-uncomment "ext:web-mode")
-(defvar web-mode-engine)
-
-(defun evilnc--warn-on-web-mode (is-comment)
- "Check certain part of html code IS-COMMENT."
- (let* ((comment-operation (concat "web-mode-"
- (if is-comment "comment-" "uncomment-")
- web-mode-engine
- "-block")))
- (unless (intern-soft comment-operation)
- (message "defun %s NOT implemented in web-mode! Fix it or report to its maintainer."
- comment-operation))
- is-comment))
-
-(defun evilnc--web-mode-is-region-comment (beg end)
- "Is region between BEG and END is comment in web mode?"
- (let* ((rlt (and (save-excursion
- (goto-char beg)
- (goto-char (line-end-position))
- (re-search-backward "^\\|[^[:space:]]")
- (evilnc-web-mode-is-comment))
- (evilnc-web-mode-is-comment (/ (+ beg end) 2))
- (save-excursion
- (goto-char end)
- (back-to-indentation)
- (evilnc-web-mode-is-comment)))))
- rlt))
-
-(defun evilnc--web-mode-do-current-line ()
- "In `web-mode', have to select whole line to comment."
- (let* (first-char-is-snippet e)
-
- (save-excursion
- (goto-char (line-beginning-position))
- (skip-chars-forward "[:space:]" (line-end-position))
- (setq first-char-is-snippet (get-text-property (point) 'block-side)))
-
- ;; comment the snippet block at first
- (when (and evilnc-comment-both-snippet-html (not first-char-is-snippet))
- (save-excursion
- (let* (fired)
- (goto-char (line-beginning-position))
- ;; please note (line-beginning-position) is changing in (while)
- (while (< (point) (line-end-position))
- (forward-char)
- (if (get-text-property (point) 'block-side)
- (when (not fired)
- (save-excursion
- (push-mark (1+ (point)) t t)
- (goto-char (point))
- (web-mode-comment-or-uncomment))
- (setq fired t))
- (setq fired nil))))))
-
- ;; comment the html line
- ;; To comment one line ONLY, you need select a line at first,
- ;; in order to work around web-mode "feature".
- (push-mark (setq e (line-end-position)) t t)
- (goto-char (line-beginning-position))
- (skip-chars-forward "[:space:]" e)
- (evilnc--warn-on-web-mode (evilnc--web-mode-is-region-comment (point) e))
- (web-mode-comment-or-uncomment)))
-
-(defun evilnc--web-mode-comment-or-uncomment (beg end)
- "Comment/uncomment line by line from BEG to END.
-DO-COMMENT decides we comment or uncomment."
- ;; end will change when you comment line by line
- (let* (line-cnt tmp)
- ;; make sure beg <= end
- (when (> beg end)
- (setq tmp beg)
- (setq beg end)
- (setq end tmp))
-
- ;; start (un)comment
- (save-excursion
- (setq line-cnt (evilnc--count-lines beg end))
- (goto-char beg)
- (while (> line-cnt 0)
- (evilnc--web-mode-do-current-line)
- (forward-line)
- (setq line-cnt (1- line-cnt))))))
-
-(defun evilnc--comment-or-uncomment-region (beg end)
- "Comment or uncommment region from BEG to END."
- (cond
- ((eq major-mode 'web-mode)
- ;; elixir is not supported in web-mode for now
- (unless (fboundp 'web-mode-comment-elixir-block)
- (defalias 'web-mode-comment-elixir-block 'web-mode-comment-erb-block)
- (defalias 'web-mode-uncomment-elixir-block 'web-mode-uncomment-erb-block))
- (evilnc--web-mode-comment-or-uncomment beg end))
- (t
- (evilnc--working-on-region beg end 'comment-or-uncomment-region))))
-
-(defun evilnc--current-line-num ()
- "Get current line number."
- (save-restriction
- (widen)
- (save-excursion
- (beginning-of-line)
- (1+ (count-lines 1 (point))))))
-
-(defun evilnc--find-dst-line-num (UNITS)
- "Find closet line whose line number ends with digit UNITS.
-Given UNITS as 5, line 5, line 15, and line 25 are good candidates.
-If UNITS is 16, line 16, line 116, and line 216 are good candidates."
- (let* ((cur-line-num (evilnc--current-line-num))
- dst-line-num
- (r 1)
- (l (length (number-to-string UNITS))))
- (while (> l 0)
- (setq r (* r 10))
- (setq l (- l 1)))
- (if (>= (mod cur-line-num r) UNITS)
- (setq UNITS (+ UNITS r)))
- (setq dst-line-num (+ cur-line-num (- UNITS (mod cur-line-num r))))))
-
-;; ==== below this line are public commands
-
-;;;###autoload
-(defun evilnc-comment-or-uncomment-paragraphs (&optional num)
- "Comment or uncomment NUM paragraph(s).
-A paragraph is a continuation non-empty lines.
-Paragraphs are separated by empty lines."
- (interactive "p")
- (let* ((i 0)
- rlt
- (b (point-max))
- (e 0))
- (catch 'break
- (while (< i num)
- (setq i (1+ i))
- (setq rlt (evilnc--get-one-paragraph-region))
- (setq b (if (< (nth 0 rlt) b) (nth 0 rlt) b))
- (setq e (if (> (nth 1 rlt) e) (nth 1 rlt) e))
-
- ;; prepare for the next paragraph
- (if (and rlt (< i num))
- (progn
- ;; e should be the end of last non-empty line
- (goto-char e)
-
- ;; move to an empty line
- (forward-line)
-
- ;; move to next non-empty line
- (re-search-forward "^[ \t]*[^ \t]" nil t)
-
- (if (<= (line-beginning-position) e)
- (throw 'break i)))
- (throw 'break i))))
-
- (when (<= b e)
- (save-excursion
- (evilnc--fix-buggy-major-modes)
- (evilnc--comment-or-uncomment-region b e)))))
-
-;;;###autoload
-(defun evilnc-comment-or-uncomment-to-the-line (&optional LINENUM)
- "Comment or uncomment from current line to LINENUM line."
- (interactive "nLine: ")
- (if (not (region-active-p))
- (let* ((b (line-beginning-position))
- (e (line-end-position)))
- (save-excursion
- (evilnc--goto-line LINENUM)
- (if (< (line-beginning-position) b)
- (setq b (line-beginning-position)))
- (if (> (line-end-position) e)
- (setq e (line-end-position)))
- (evilnc--fix-buggy-major-modes)
- (evilnc--comment-or-uncomment-region b e)
- ))))
-
-;;;###autoload
-(defun evilnc-quick-comment-or-uncomment-to-the-line (&optional units)
- "Comment/uncomment to line number by last digit(s) whose value is UNITS.
-For exmaple, you can use either \
-\\<M-53>\\[evilnc-quick-comment-or-uncomment-to-the-line] \
-or \\<M-3>\\[evilnc-quick-comment-or-uncomment-to-the-line] \
-to comment to the line 6453"
- (interactive "p")
- (let* ((dst-line-num (evilnc--find-dst-line-num units)))
- (evilnc-comment-or-uncomment-to-the-line dst-line-num)
- (evilnc--goto-line (+ 1 dst-line-num))))
-
-;;;###autoload
-(defun evilnc-toggle-invert-comment-line-by-line ()
- "Please note this command may NOT work on complex evil text objects."
- (interactive)
- (if evilnc-invert-comment-line-by-line
- (setq evilnc-invert-comment-line-by-line nil)
- (setq evilnc-invert-comment-line-by-line t))
- (message (if evilnc-invert-comment-line-by-line
- "Each line's comment status will be inverted"
- "Each line's comment status will NOT be inverted")))
-
-;;;###autoload
-(defun evilnc-toggle-comment-empty-lines ()
- "Toggle the flag which decide wether empty line will be commented."
- (interactive)
- (if comment-empty-lines
- (setq comment-empty-lines nil)
- (setq comment-empty-lines t))
- (message (if comment-empty-lines
- "Empty line(s) will be commented"
- "Empty line(s) will NOT be commented")))
-
-;;;###autoload
-(defun evilnc-comment-or-uncomment-lines (&optional num)
- "Comment or uncomment NUM lines. NUM could be negative.
-
-Case 1: If no region selected, comment/uncomment on current line.
-If NUM>1, comment/uncomment extra N-1 lines from next line.
-
-Case 2: Selected region is expanded to make it contain whole lines.
-Then we comment/uncomment the expanded region. NUM is ignored.
-
-Case 3: If a region inside of ONE line is selected,
-we comment/uncomment that region.
-CORRECT comment syntax will be used for C++/Java/Javascript."
- (interactive "p")
- ;; donot move the cursor
- ;; support negative number
- (cond
- ((and (= 1 num) (string-match "^[ \t]*$" (buffer-substring-no-properties (line-beginning-position) (line-end-position))))
- ;; comment on current empty line
- (comment-dwim nil))
- (t
- (save-excursion
- (when (< num 0)
- (forward-line (1+ num))
- (setq num (- 0 num)))
- (evilnc--operation-on-lines-or-region '(lambda (b e)
- (evilnc--fix-buggy-major-modes)
- (evilnc--comment-or-uncomment-region b e))
- num)))))
-
-;;;###autoload
-(defun evilnc-copy-and-comment-lines (&optional num)
- "Copy&paste NUM lines and comment out original lines.
-NUM could be negative.
-
-Case 1: If no region selected, operate on current line.
-if NUM>1, comment/uncomment extra N-1 lines from next line
-
-Case 2: Selected region is expanded to make it contain whole lines.
-Then we operate the expanded region. NUM is ignored."
- (interactive "p")
- ;; support negative number
- (when (< num 0)
- (forward-line (1+ num))
- (setq num (- 0 num)))
-
- (let* ((original-column (current-column)))
- (evilnc--operation-on-lines-or-region
- '(lambda (beg end)
- (evilnc--fix-buggy-major-modes)
- (let* ((str (buffer-substring-no-properties beg end)))
- (cond
- (evilnc-original-above-comment-when-copy-and-comment
- (let* ((p (point)))
- (comment-region beg end)
- (goto-char beg)
- (insert-before-markers (concat str "\n"))
- (goto-char p)))
- (t
- (goto-char end)
- (newline 1)
- (insert-before-markers str)
- (comment-region beg end)))))
- num)
- ;; Go to original column after evilnc-copy-and-comment-lines
- ;; @see https://github.com/redguardtoo/evil-nerd-commenter/issues/79
- ;; Thanks for Kevin Brubeck (AKA unhammer) for idea/implementation
- (move-to-column original-column)))
-
-;;;###autoload
-(defun evilnc-comment-and-kill-ring-save (&optional num)
- "Comment lines save origin lines into `kill-ring'.
-NUM could be negative.
-
-Case 1: If no region selected, operate on current line.
-;; if NUM>1, comment/uncomment extra N-1 lines from next line
-
-Case 2: Selected region is expanded to make it contain whole lines.
-Then we operate the expanded region. NUM is ignored."
- (interactive "p")
- ;; support negative number
- (when (< num 0)
- (forward-line (1+ num))
- (setq num (- 0 num)))
-
- (evilnc--operation-on-lines-or-region
- '(lambda (beg end)
- (evilnc--fix-buggy-major-modes)
- (kill-new (buffer-substring-no-properties beg end))
- (comment-region beg end))
- num))
-
-;; {{ for non-evil user only
-;;;###autoload
-(defun evilnc-copy-to-line (&optional LINENUM)
- "Copy from current line to LINENUM line. For non-evil user only."
- (interactive "nCopy to line: ")
- (if (not (region-active-p))
- (let* ((b (line-beginning-position))
- (e (line-end-position)))
- (save-excursion
- (evilnc--goto-line LINENUM)
- (if (< (line-beginning-position) b)
- (setq b (line-beginning-position)))
- (if (> (line-end-position) e)
- (setq e (line-end-position)))
- (kill-new (buffer-substring-no-properties b e))))))
-
-;;;###autoload
-(defun evilnc-kill-to-line (&optional linenum)
- "Kill from the current line to the LINENUM line. For non-evil user only."
- (interactive "NKill to line: ")
- (if (not (region-active-p))
- (let* ((b (line-beginning-position))
- (e (line-end-position)))
- (save-excursion
- (evilnc--goto-line linenum)
- (if (< (line-beginning-position) b)
- (setq b (line-beginning-position)))
- (if (> (line-end-position) e)
- (setq e (line-end-position)))
- ;; +1 because we need remove the CR
- (setq e (+ 1 e))
- (if (> e (point-max)) (setq e (point-max)))
- (kill-region b e)))))
-;; }}
-
-;;;###autoload
-(defun evilnc-version ()
- "The version number."
- (interactive)
- (message "3.1.3"))
-
-(defvar evil-normal-state-map)
-(defvar evil-visual-state-map)
-(defvar evil-inner-text-objects-map)
-(defvar evil-outer-text-objects-map)
-;;;###autoload
-(defun evilnc-default-hotkeys (&optional no-evil-keybindings)
- "Setup the key bindings of evil-nerd-comment.
-If NO-EVIL-KEYBINDINGS is t, we don't define keybindings in EVIL."
- (interactive)
- ;; Install hotkeys for Emacs mode
- (global-set-key (kbd "M-;") 'evilnc-comment-or-uncomment-lines)
- (global-set-key (kbd "C-c l") 'evilnc-quick-comment-or-uncomment-to-the-line)
- (global-set-key (kbd "C-c c") 'evilnc-copy-and-comment-lines)
- (global-set-key (kbd "C-c p") 'evilnc-comment-or-uncomment-paragraphs)
-
- ;; Install key bindings for evil
- (unless no-evil-keybindings
- (eval-after-load 'evil
- '(progn
- (define-key evil-normal-state-map ",ci" 'evilnc-comment-or-uncomment-lines)
- (define-key evil-visual-state-map ",ci" 'evilnc-comment-or-uncomment-lines)
- (define-key evil-normal-state-map ",cl" 'evilnc-quick-comment-or-uncomment-to-the-line)
- (define-key evil-normal-state-map ",ll" 'evilnc-quick-comment-or-uncomment-to-the-line)
- (define-key evil-normal-state-map ",cc" 'evilnc-copy-and-comment-lines)
- (define-key evil-visual-state-map ",cc" 'evilnc-copy-and-comment-lines)
- (define-key evil-normal-state-map ",cp" 'evilnc-comment-or-uncomment-paragraphs)
- (define-key evil-normal-state-map ",cr" 'comment-or-uncomment-region)
- (define-key evil-normal-state-map ",cv" 'evilnc-toggle-invert-comment-line-by-line)))
-
- ;; Install operator for evil text objects
- (eval-after-load 'evil-nerd-commenter-operator
- '(progn
- ;; operator to comment at text objects
- (define-key evil-normal-state-map ",." 'evilnc-copy-and-comment-operator)
- (define-key evil-visual-state-map ",." 'evilnc-copy-and-comment-operator)
- (define-key evil-normal-state-map ",," 'evilnc-comment-operator)
- (define-key evil-visual-state-map ",," 'evilnc-comment-operator)
-
- ;; comment itself is text object
- (define-key evil-inner-text-objects-map evilnc-comment-text-object 'evilnc-inner-comment)
- (define-key evil-outer-text-objects-map evilnc-comment-text-object 'evilnc-outer-commenter)))))
-
-;; Attempt to define the operator on first load.
-;; Will only work if evil has been loaded
-(eval-after-load 'evil
- '(require 'evil-nerd-commenter-operator))
-
-(provide 'evil-nerd-commenter)
-;;; evil-nerd-commenter.el ends here
diff --git a/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter.elc b/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter.elc
deleted file mode 100644
index 7d8b062..0000000
--- a/.emacs.d/elpa/evil-nerd-commenter-20171206.441/evil-nerd-commenter.elc
+++ /dev/null
Binary files differ