Code Monkey home page Code Monkey logo

evil-nerd-commenter's People

Contributors

cruegge avatar dalugm avatar darth10 avatar dickby avatar duchainer avatar duianto avatar fice-t avatar lalopmak avatar leungbk avatar madand avatar mamapanda avatar mssdvd avatar mswift42 avatar punassuming avatar pythonnut avatar rafauke avatar ryuslash avatar syohex avatar thebb avatar tuhdo avatar untf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

evil-nerd-commenter's Issues

Paredit mode

In paredit mode, when I have something like the following:

(function
    (some-call arg arg arg)
    (some-other-call arg))

and insert a ; on the last line it automatically does this

(function
    (some-call arg arg arg)
   ; (some-other-call arg)
    )

to keep the parentheses balanced.

But when I mark the line with nerd-commenter and call evilnc-comment-or-uncomment-lines:

(function
    (some-call arg arg arg)
   ; (some-other-call arg))

Customizing evil-nerd-commander

When no text is marked, I would like M-; to toggle commenting the current line. Can you help me modify ~/.emacs to achieve this behavior?

Problem in evil usage

I have enabled evil-mode and evil-leader is set to ,. And I have put (evilnc-default-hotkeys) in my configuration and ,ci works well. But the evil usage does not work, for example, ,,, does nothing.

Do I make something wrong?

M-; should start a comment on an empty line

With the default setup from

(evilnc-default-hotkeys)

pressing M-; does nothing in the following situation (where | is the cursor):

|
(setq some-var nil)

It would be convenient if it started a new comment.

It handles the inverse operation correctly:

;; |
(setq some-var nil)

followed by M-; yields

|
(setq some-var nil)

join comment lines?

I found your answer to a question about joining comment lines and removing the comment delimiter. This is functionality I'm pretty sure I had in vim (via regular J, not a separate bind), though I can't remember for sure; perhaps it was some plugin I was using.

In any case, it's very useful functionality that I was surprised to not find in emacs or in any packages that I could find. You seemed to imply that you did it in this package, but I could find no mention of joining functionality.

Or were you simply referring to the method of detecting whether one was in a comment? If so, would you consider adding comment joining functionality to this package? It'd be nice if we could still use J and the comment-joining functionality would only kick-in if we were in a comment, otherwise it would delegate to the regular J evil functionality, instead of having to have yet another separate bind (although perhaps some people would like that as an option).

"sexy" mode

Hi (my apologies if this is not the right place to ask questions - I can close and reopen in stack overflow if desired),

I'm a vimmer coming over to spacemacs. I used to use nerdcommenter, so i was happy to see this port in emacs, and auto-included in spacemacs.

In vim (let's use javascript as an example), let's pretend I used visual mode to highlight a couple lines. I could use <Leader>cc to comment them with //, or <Leader>cs to do "sexy" comments (wishing for a better name...) where it would surround the highlighted lines with /** */.

Is this possible with evil-nerd-commenter? I can't seem to find anything in the emacs commands to support it.

Thanks very much for any advice/replies.

Bug when commenting on marked regions

Hello,

When I select a region using shift-v and comment it using evilnc-comment-or-uncomment-lines, it also comments the line underneath the region.

Doesn't happen with a region selected with v.

evilnc-comment-or-uncomment-lines failed after update to the latest version

error message:
Symbol's function definition is void: org-edit-src-find-region-and-lang

I am using the latest version of emacs and the packages below:

Enabled minor modes: Anzu Auto-Complete Auto-Composition
Auto-Compression Auto-Encryption Column-Number Cua Desktop-Save Evil
Evil-Leader Evil-Local Evil-Matchit Fic File-Name-Shadow Font-Lock
Global-Anzu Global-Auto-Complete Global-Auto-Revert
Global-Evil-Matchit Global-Font-Lock Global-Linum
Global-Page-Break-Lines Global-Rinari Global-Surround Global-Undo-Tree
Goto-Address-Prog Helm-Match-Plugin Helm-Occur-Match-Plugin Hes
Ido-Everywhere Ido-Ubiquitous Line-Number Linum Mouse-Wheel
Page-Break-Lines Rainbow-Delimiters Recentf Shell-Dirtrack
Show-Smartparens Show-Smartparens-Global Smartparens
Smartparens-Global Surround Tooltip Transient-Mark Undo-Tree
Whitespace Winner Yas Yas-Global

(Information about these minor modes follows the major mode info.)

Emacs-Lisp mode defined in `lisp-mode.el':
Major mode for editing Lisp code to run in Emacs.

Test suite?

Hello @redguardtoo
Thanks for this great plugin :)

You mention in the README that you have tested it, but I don't see the test suite.
Was wondering where is it? (or do you do it by hand?)

Tested on Emacs 23.4, 24.3, 24.4, 24.5

Help integrating matlab/octave-mode with evil-nerd-commenter?

I love using evil-nerd-commenter to toggle the commented/uncommented state of blocks of code! However, when I try to do this in matlab-mode or octave-mode, it just inserts a new blank comment.

How can we tweak these modes to toggle commenting better?

evilnc-comment-or-uncomment-lines fail to uncomment for autoconf

It does work when I comment some line, and it always adds dnl to the begin of the line. However It fails to uncomment, neither # nor dnl of the commented line.

FYI, the minor modes that are activated is as belows:

Enabled minor modes: Auto-Composition Auto-Compression Auto-Encryption Auto-Fill
Autopair Autopair-Global Column-Number Desktop-Save Display-Time Evil Evil-Local
File-Name-Shadow Font-Lock Global-Auto-Complete Global-Auto-Revert
Global-Font-Lock Global-Linum Global-Pointback Global-Undo-Tree
Goto-Address-Prog Ido-Everywhere Ido-Ubiquitous Line-Number Linum Mouse-Wheel
Openwith Pointback Recentf Shell-Dirtrack Show-Paren Tooltip Transient-Mark
Undo-Tree Yas Yas-Global

Thanks,
Hongxu Chen

support web-mode

use emacs api to select region, then call web-mode-comment
after comment I may need uncomment and vice vesa because web-mode "smart" comment api.

[Bug Report] evil-nerd-commenter-20140921.300 gives error message at intialization

Hi,
I received below error message after updating evil-nerd-commenter on melpa recently.

Warning (initialization): An error occurred while loading `/Users/dawu/.emacs.d/init.el':

Symbol's value as variable is void: evilnc-comment-operator

To ensure normal operation, you should investigate and remove the
cause of the error in your initialization file.  Start Emacs with
the `--debug-init' option to view a complete error backtrace.

I think this is related to the compiled byte files under evil-nerd-commenter directory. i.e. evil-nerd-commenter-pkg.elc and evil-nerd-commenter.elc. After manually deleted those two, I don't get the error message anymore.

At first I thought this might be some problem on melpa side, but purcell believes it looks like an upstream issue melpa/melpa#2042.

I use evil-nerd-commenter in emacs-prelude, it worked fine before until I updated my packages via package manager on melpa recently. Anyway to address this problem?

Thanks,

Debugger error when trying to comment sections of my .emacs

I'm trying to use evil nerd commenter to toggle on comments for the last block of code in my .emacs file. This triggers a debugger error.

Code:

https://github.com/mcandre/dotfiles/blob/master/.emacs#L589-L594

Error:

Debugger entered--Lisp error: (void-function org-edit-src-find-region-and-lang)
  org-edit-src-find-region-and-lang()
  evilnc--working-on-region(19001 19116 comment-or-uncomment-region)
  evilnc--comment-or-uncomment-region(19001 19116)
  (lambda (b e) (evilnc--fix-buggy-major-modes) (evilnc--comment-or-uncomment-region b e))(19001 19116)
  evilnc--operation-on-lines-or-region((lambda (b e) (evilnc--fix-buggy-major-modes) (evilnc--comment-or-uncomment-region b e)) 1)
  evilnc-comment-or-uncomment-lines(1)
  call-interactively(evilnc-comment-or-uncomment-lines nil nil)

provide way for cancel global keybinds

why autoload so many global keybinds and not provide way for configuration .
I use org-mode which had define C-c c for org-capture . it fails when (require evil-nerd-commenter)
so I must modiy evil-nerd-commenter ,by now has no way to config it , can support it ?

;;;###autoload
(defun evilnc-default-hotkeys ()
  "Set the hotkeys of evil-nerd-comment"
  (interactive)
  (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)

Consider using \ as "leader" key instead of comma

May I suggest using backslash \ as default leader key in evilnc-hotkey-comment-operator and evilnc-default-hotkeys instead of comma?

I would really like to keep my evil mode the same with default vim key bindings as much as possible. I've also noticed that in vim, neither vim-matchit nor nerdcommenter would overwrite the normal , functionality by default. Maybe it's better not to use , as default leader key for their Emacs equivalence too?

Thanks for your time and patience to import such great modes into Emacs.

evilnc-invert-comment-line-by-line bug!

Hi, I'm using your package for quite a while now and I like it a lot.
Today I tried the invert-line-by-line option for the first time and it doesn't work as expected.
Example:
if I type "evilnc-comment-operator j" , 3 instead of 2 lines are commented.
It seems like the wrong starting point of the evil-operator range is chosen.

Thanks for your work.

Issue with org-indent-mode

Hi,
Maybe you've encountered this issue before, but I looked everywhere and were not able to find any solution for this.
When I activate org-indent-mode, and I try and comment out code snippet in a file (this is my config file), the whole org-subtree opens up to the parent node, and all its children open.

If I have this:

** Python configuration
#+begin_src emacs-lisp
(setq python-python-command "~/anaconda3/bin/ipython")
(setq py-shell-switch-buffers-on-execute-p t)
(setq py-switch-buffers-on-execute-p t)
(setq python-shell-virtualenv-path "~/anaconda3")
(when (executable-find "ipython")
  (setq python-shell-interpreter "ipython"))
#+end_src

** Anaconda config...

and try to comment a command, I will end up with:

** Python configuration
#+begin_src emacs-lisp
(setq python-python-command "~/anaconda3/bin/ipython")
(setq py-shell-switch-buffers-on-execute-p t)
;; (setq py-switch-buffers-on-execute-p t)
(setq python-shell-virtualenv-path "~/anaconda3")
(when (executable-find "ipython")
  (setq python-shell-interpreter "ipython"))
#+end_src

** Anaconda config
#+begin_src emacs-lisp
(add-hook 'python-mode-hook 'anaconda-mode)
(setq python-shell-virtualenv-path "~/anaconda3")
#+end_src

I tried going through my config file, but were not able to find anything related. If you need more information, let me know.

how to set 'gc' as my comment operator?

hello. plugins like vim-commentary and tcomment use the gc as an operator. so i can gcc to toggle a line, gcG to comment to the end of a file, or gcp to comment a paragraph, etc.

i tried adding (setq evilnc-hotkey-comment-operator "gc") to my .emacs but it's not working as expected. a value of "g c" doesn't work either.

am i configuring it wrong or is this not supported? thanks.

Symbol's value as variable is void: evilnc-comment-operator

Hello!

I'm newish to Emacs, and just rebuilt my configuration using Cask. After installing evil-nerd-commenter I get the following error:

Symbol's value as variable is void: evilnc-comment-operator

My configuration is something like this (for evil):

(require 'evil)
(require 'evil-leader)
(require 'evil-matchit)
(require 'evil-nerd-commenter)
(require 'key-chord)
(evil-mode t)

(evilnc-default-hotkeys)

Which is where the error is triggered. Any tips on how to work through this? I'm not very familiar with Emacs lisp at this point. Thank you for any help in advance!

User prompt for evilnc-comment-or-uncomment-to-the-line and evilnc-copy-and-comment-lines

These commands:

  • evilnc-comment-or-uncomment-to-the-line
  • evilnc-copy-to-line

would be more convenient if after executing, user get a prompt asking for a line number. The key bindings are the same, but this is more intuitive. The reason is, sometimes user can accidentally trigger the key bindings without a prefix argument, and without a prefix argument, the commands comment or copy from the first line to the current line. This is confusing for new people, and annoying when user forgets to supply a prefix argument.

The number of key strokes is the same:

  • Using prefix argument: C-u <number> <key binding for command>
  • Using a prompt: <key binding for command> <number> RET

As you can see, it is more explicit and safer for user when they accidentally run the commands.

evil-nerd-quick-comment-to-line

No body like to press "953,cl to comment to the line 953", it's 6 key press, instead, they want to press to "3,cl" or better "3,ll", "33,ll" will be next 3.

Elixir Language Templating Commenting

When something like this:

<%= form_for @changeset, @action, fn f -> %>
  <%= if @changeset.action do %>
    <div class="alert alert-danger">
      <p>Oops, something went wrong! Please check the errors below:</p>
      <ul>
        <%= for {attr, message} <- f.errors do %>
          <li><%= humanize(attr) %> <%= message %></li>
        <% end %>
      </ul>
    </div>
  <% end %>

  <div class="form-group">
    <%= submit "Submit", class: "btn btn-primary" %>
  </div>
<% end %>

is commented, you get this:

<!-- <%= form_for @changeset, @action, fn f -> %> -->
<!--   <%= if @changeset.action do %> -->
<!--     <div class="alert alert-danger"> -->
<!--       <p>Oops, something went wrong! Please check the errors below:</p> -->
<!--       <ul> -->
<!--         <%= for {attr, message} <- f.errors do %> -->
<!--           <li><%= humanize(attr) %> <%= message %></li> -->
<!--         <% end %> -->
<!--       </ul> -->
<!--     </div> -->
<!--   <% end %> -->

<!--   <div class="form-group"> -->
<!--     <%= submit "Submit", class: "btn btn-primary" %> -->
<!--   </div> -->
<!-- <% end %> -->

However, it doesn't actually comment out the templating tags as they have to be turned to the <%# %> form. One suggestion would be to keep the existing html style formatting as it helps the editor display things properly.

evilnc-comment-or-uncomment-lines broken in XML web-mode

  • Open a new buffer in web-mode.
  • Enter some text (e.g. test).
  • Execute evilnc-comment-or-uncomment-lines.

The result is <!-- test -->.

  • Execute evilnc-comment-or-uncomment-lines again.

The result is <!-- <!-- test --> -->. Expected test.

evilnc should support negative arguments

Currently, when I try negative arguments, evilnc-comment-or-uncomment-lines does nothing. It should comments previous line according to the supplied argument.

Other similar functions should support negative argument as well.

evil-nerd-commenter dosent work within org-mode code block

Hi
just discoverd evil-nerd-commenter and loving it.
there is one issue i found where it wont work inside org mode code blocks ie:

+begin_src emacs-lisp results none

CODE HERE

+end_src

any idea why? can this be fixed

kind regards

Z

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.