Comment/uncomment line(s) is easy in Emacs

  |   Source

It's easy if you use evil-nerd-commenter because commenting/uncommenting line(s) is only pressing ",ci" in evil-mode.

You can also select text and press M-; to comment the lines in the region. If part of the line is not in the selected, the whole line will still be commented out. This saves your extra key pressing for moving cursor to the beginning of the first line or moving the cursor to the end of the last line.

The reason to make commenting efficient is that I need comment/uncomment code for debug purpose.

Some people say comment out the code is not a right way to debug. The right way is using debugger.

In some huge projects, debugger makes no sense for many reasons:

  • The debugger for that Domain Specific Language simply does not exist
  • Bugs can be reproduced ONLY on production server where debugger is not installed
  • Too much overhead to set up debugger
Comments powered by Disqus