Why not toggle comments with CTRL+T instead of "increment % in front of the line"?
This feature doesn't look so hard to implement and it is very useful!
Feature Requests: #1085
Feature Requests: #483
Anonymous
If you go into the details, it's a bit harder. You cannot simply toggle on a per-line basis for selections (which also need to be covered by the command). What if you have a selection with part normal lines and part commented lines. What if you have multiple selections?
I'm not saying that it's not possible to implement a good comment toggle, but one would have to carefully think about all the corner cases and handle them correctly. It's not a one-liner.
implemented hg 6109 (6bf48f7a3fef)
Last edit: Tim Hoffmann 2016-07-29
One could use a very simple and pragmatic solution, which is also done by various other programs these days (sublime, spyder, notepad++,...)
The command only looks at those lines that are currently at least partly selected one character or more.
If all these lines are currently commented out, they will all be commented in.
If this isn't the case, they will all be commented out.
This is also simple to implement and already helps a lot for many daily usecases, and furthermore people are already used to that behaviour from other programs anyway...
Example:
All these lines are at least selected partly => New Toggle comment command