emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/evil-nerd-commenter b4fcadabd9 001/235: first import


From: ELPA Syncer
Subject: [nongnu] elpa/evil-nerd-commenter b4fcadabd9 001/235: first import
Date: Thu, 6 Jan 2022 02:59:29 -0500 (EST)

branch: elpa/evil-nerd-commenter
commit b4fcadabd9ae56dc878c63e0078b08a0d3dd319b
Author: chen bin <chenbin.sh@gmail.com>
Commit: chen bin <chenbin.sh@gmail.com>

    first import
---
 .gitignore                 | 26 ++++++++++++++++++++
 README.org                 | 42 ++++++++++++++++++++++++++++++++
 evil-nerd-commenter-pkg.el |  2 ++
 evil-nerd-commenter.el     | 60 ++++++++++++++++++++++++++++++++++++++++++++++
 pkg.sh                     | 11 +++++++++
 5 files changed, 141 insertions(+)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000000..208721001a
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,26 @@
+### /Users/cb/.gitignore-boilerplates/Global/Emacs.gitignore
+
+*~
+\#*\#
+/.emacs.desktop
+/.emacs.desktop.lock
+.elc
+auto-save-list
+tramp
+.\#*
+
+# Org-mode
+.org-id-locations
+*_archive
+
+
+### /Users/cb/.gitignore-boilerplates/Global/Vim.gitignore
+
+.*.sw[a-z]
+*.un~
+Session.vim
+.netrwhist
+
+*.tar
+*.elc
+
diff --git a/README.org b/README.org
new file mode 100644
index 0000000000..63f9d93bb2
--- /dev/null
+++ b/README.org
@@ -0,0 +1,42 @@
+* evil-nerd-commenter (current version 0.0.1)
+As a developer, I often need comment/uncomment lines for debugging or adding 
some short comment in the code block.
+
+As I know, the [[http://www.vim.org/scripts/script.php?script_id=1218][Nerd 
Commenter]] for Vim is the most efficient way to doing this thing. 
Unfortunately, there is no similar plugin in Emacs.
+
+That's why I develop this Nerd Commenter simulator for Emacs people.
+* Install
+cpputils-cmake is already uploaded to [[http://marmalade-repo.org/]]. So the 
best way to install it is using Emacs' package manager.
+* Set up
+Nothing to set up. There is only one command 
"evilnc-comment-or-uncomment-lines". Just use it.
+
+You may use the hotkeys defined in evil-nerd-commenter by add following line 
into ~/.emacs:
+#+BEGIN_SRC elisp
+(evilnc-default-hotkeys)
+#+END_SRC
+
+The hotkey is "M-;" in emacs normal mode and "<Leader>ci" (",ci") in evil-mode.
+* Usage
+Example 1:
+"M-x evilnc-comment-or-uncomment-lines" comment/uncomment current line.
+
+Example 2:
+"C-u NUM M-x evilnc-comment-or-uncomment-lines" comment/uncomment next NUM 
lines.
+
+Example 3:
+Select a region and "M-x evilnc-comment-or-uncomment-lines". The region will 
automatically expand to contain whole lines. Then  comment/uncomment the region.
+
+Example 4:
+If you use [[http://emacswiki.org/emacs/Evil][evil-mode]] and get the package 
evil-leader installed. Comment 9 lines could be as easily as type "9,ci" (only 
four keys).
+* Contact me
+You can report bugs at [[https://github.com/redguardtoo/evil-nerd]]-commenter. 
My email is <chenbin DOT sh AT gmail>.
+* License
+Copyright (C) 2012 Chen Bin
+
+Author: Chen Bin <chenbin DOT sh AT gmail DOT com
+
+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 3 of the License, 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, see [[http://www.gnu.org/licenses/]].
+
diff --git a/evil-nerd-commenter-pkg.el b/evil-nerd-commenter-pkg.el
new file mode 100644
index 0000000000..6eac290ce4
--- /dev/null
+++ b/evil-nerd-commenter-pkg.el
@@ -0,0 +1,2 @@
+(define-package "evil-nerd-commenter" "0.0.1"
+                "Comment/uncomment lines efficiently. Like Nerd Commenter in 
Vim")
diff --git a/evil-nerd-commenter.el b/evil-nerd-commenter.el
new file mode 100644
index 0000000000..493cf1f71b
--- /dev/null
+++ b/evil-nerd-commenter.el
@@ -0,0 +1,60 @@
+;;; evil-nerd-commenter --- Comment/uncomment lines efficiently. Like Nerd 
Commenter in Vim
+
+;; Copyright (C) 2012 Chen Bin
+;; Author: Chen Bin <chenbin.sh@gmail.com>
+;; URL: http://github.com/redguardtoo/evil-nerd-commenter
+;; Keywords: commenter vim line evil
+;; Version: 0.0.1
+
+;; This file is not part of GNU Emacs.
+
+;; This file is free software (GPLv3 License)
+
+;; How to set it up:
+;; 1. There is ONLY one command "evilnc-comment-or-uncomment-lines".
+;; 2. "evilnc-default-hotkeys" will assign hotkey "M-;" for emacs normal mode 
and "<Leader>ci" for evil-mode.
+;; 3. Calling (evilnc-default-hotkeys) is NOT needed if you define your own 
hotkey.
+
+;;; Code:
+
+;;;###autoload
+(defun evilnc-comment-or-uncomment-lines (&optional NUM)
+  "Comment or uncomment lines.
+   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: If a region selected, the region is expand to make sure the region 
contain
+   whole lines. Then we comment/uncomment the expanded region. NUM is ignored."
+  (interactive "p")
+  (if (not (region-active-p))
+      (let ((b (line-beginning-position))
+            e)
+        (save-excursion
+          (forward-line (- NUM 1))
+          (setq e (line-end-position))
+          (comment-or-uncomment-region b e)
+          )
+        )
+    ;; expand selected region
+    (save-excursion
+      (let ((b (region-beginning))
+            (e (region-end))
+            )
+        (goto-char b)
+        (setq b (line-beginning-position))
+        (goto-char e)
+        (setq e (line-end-position))
+        (comment-or-uncomment-region b e)))
+    ))
+
+;;;###autoload
+(defun evilnc-default-hotkeys ()
+  "Set the hotkeys of evil-nerd-comment"
+  (interactive)
+  (global-set-key "\M-;" 'evilnc-comment-or-uncomment-lines)
+  ;; set hot key for evil-mode, package evil-leader is needed
+  (if (fboundp 'evil-leader/set-key)
+      ;; same as nerd commenter in vim
+      (evil-leader/set-key "ci" 'evilnc-comment-or-uncomment-lines))
+  )
+
+(provide 'evil-nerd-commenter)
diff --git a/pkg.sh b/pkg.sh
new file mode 100755
index 0000000000..b12ef1c731
--- /dev/null
+++ b/pkg.sh
@@ -0,0 +1,11 @@
+#!/bin/bash
+pkg=evil-nerd-commenter-0.0.1
+mkdir $pkg
+cp README.org $pkg
+cp *.el $pkg
+if [[ `uname -s` == *Darwin* ]]; then
+   COPYFILE_DISABLE="" tar cvf $pkg.tar $pkg/
+else
+   tar cvf $pkg.tar $pkg/
+fi
+rm -rf $pkg/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]