Giter VIP home page Giter VIP logo

evil-nerd-commenter's Introduction

evil-nerd-commenter (current version 0.0.2)

As a developer, I often need comment/uncomment lines for debugging or adding some short comment in the code block.

As I know, the 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.

Why evil-nerd-commenter is better? Show me a simple use case!

Say you want to comment out nine lines. Instead pressing “C-space M-9 C-n M-;”, now you can press “M-9 M-;” or “,9ci”.

Install

evil-nerd-commenter 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.

You may add below line into ~/.emacs which use hotkey “M-;” to toggle comment:

(evilnc-default-hotkeys)

The advantage of use “M-;” is you can set mark on the first line and scroll serveral pages down and comment all the lines in that region by “M-;”.

I prefer vi key binds. So I also use evil-mode and evil-leader.

Here is my configuration for evil-mode:

(require 'evil)
(require 'evil-leader)
(setq evil-leader/leader "," evil-leader/in-all-states t)
(evil-leader/set-key
  "ci" 'evilnc-comment-or-uncomment-lines
  "cc" 'evilnc-comment-or-uncomment-to-the-line
  )

Usage

These are available commands:

evilnc-comment-or-uncomment-lines
comment/uncomment lines.
evilnc-comment-or-uncomment-to-the-line
comment/uncomment from current line to the specified line.

Example 1: “C-u NUM M-x evilnc-comment-or-uncomment-lines”, comment/uncomment next NUM lines.

Example 2: 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 3: If you use evil-mode and get the package evil-leader installed. Comment 9 lines could be as easily as type “9<Leader>ci” (only four keys).

Example 4: “C-u 56 M-x evilnc-comment-or-uncomment-to-the-line”, comment/uncomment from current line to line 56.

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/.

evil-nerd-commenter's People

Contributors

redguardtoo avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.