Is there a way to comment out a chunk of highlighted code?
I am programming in ruby, and I hate putting # on lines individually.
Code Comment plugin obviously is a good one for # (hash) style commenting but what if you need comment out php code block with double // slashes or any other custom commenting style? For example, with one or two whitespaces added after the comment symbol.
Go to Edit->Preferences->Plugins-> and enable External Tools plugin.
Go to Tools->Manage External Tools.
Under the Tools side bar click add (+) sign, call your new tool "Comment out" and add this code into the Edit field:
#!/bin/bash
# comment out current selection
# comment style
comment="// "
xargs -i -d\\\n echo $comment{}
Set up your tool.
Shortcut Key: Alt+/ (put the cursor in the field and press Alt+/ or any other keys)
Save: Nothing
Input: Current selection (default to document)
Output: Replace current selection
Applicability: All documents? All languages? (change if you need)
To uncomment commented block of code do the same things except below ones.
Name of the Tool: "Uncomment".
Shortcut Key: Alt+Backspace
Code to insert into the Edit field:
#!/bin/bash
# uncomment current selection
# comment symbols to remove
uncomment="^\/\/ "
xargs -i -d\\\n echo {} | sed -ne "s/$uncomment//p"
Change comment/uncomment variable value (double slashes and space) with your desired commenting style.
Enjoy.