Tell me more ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

The most favorite feature of Emacs for me is to add comment to C source by Alt+;.

This feature in Emacs can do:

  • Automatically determine whether the comment is a standalone comment or a suffix comment appended to existing statement.
  • Align comment at specific column.
  • Create new comment, or re-align the existing one.

And you can also reformat comments by Alt-Q, to:

  • Normalize spaces in the comment.
  • Break long comments to several lines, wrapped.
  • Auto recognize comment style and try to keep the same style after reformat.

This feature is not about to comment out a selection of text.

I want this:

emacs comment edit

But not this:

comment out

I want to know if it is possible to add such feature to Vim?

I'm excite to know if any editor other than Emacs can do so.

share|improve this question

closed as not constructive by Xiè Jìléi, Indrek, Dave Rook, Nifle, BBlake Sep 27 '12 at 12:53

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or specific expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, see the FAQ for guidance.

1 Answer

I'd say that this feature is available in one form or another in every programming-oriented editor under the sun.

  • TextMate

    Cmd+/

  • Vim

    Vim doesn't have a "Comment" command by default but you can create mappings quite easily or use one of the many plugins available.

share|improve this answer
Have you tried the Alt-; shortcut in Emacs? – Xiè Jìléi Sep 26 '12 at 13:05
1  
No. But you asked for a feature to add comments and my answer adresses this question. Now that you have refined your question it's rather obvious that it's not what you had in mind. Don't blame the listener for your failure to communicate. – romainl Sep 26 '12 at 14:11
I didn't blame you. I downvoted your answer, though. I refined the question to emphasize on emacs-like, but the original question was clear on that. – Xiè Jìléi Sep 26 '12 at 14:23
I asked you do you have tried .. in Emacs, because I didn't have a Mac book in hand, so I can't test TextMate. I did also not want to try all those Vim plugins, since you said every editor under the sun, I doubt if any works. So I asked to confirm on this, but not to offend you. I downvoted because this answer is not useful for me. – Xiè Jìléi Sep 26 '12 at 14:35
1  
What you asked originally, "add comment to C source" is a widely available feature. Since I don't use Emacs I had no idea what Alt+; does and (wrongly) assumed that it "add(ed) comment to C source" but, after your edit, it obviously does a lot more than "add comment to C source" so no, Alt+; is probably not as widely supported as a simple "add comment to C source". Anyway, from your screenshot, it looks like it works more or less like the Vim plugin commentary which respects pre-existing comments when commenting/uncommenting mixed lines. – romainl Sep 26 '12 at 14:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.