Add a better shortcut for commenting and uncommenting - "CTR+/"
“CTR+K,C” for commenting “CTR+K,U” for uncommenting shortcuts are NOT useful, easier to click a button on a toolbar instead.
Every developer comment / uncomment pieces of code quite often. Please add "CTR+/" shortcut for toggling comments.
This tiny addition could save tones of working hours for developers. ReSharper has it; but it would be much better to have it as a build-in feature.
Hi Supporters for this suggestion
I’m pleased to report that there’s a free new extension by my colleague Justin Clareburt that provides what you’re asking for, along with a host of other useful commands:
Please check it out and review.
Program Manager, Visual Studio IDE Team
All the other editors use control + /. Lot of developers I talk to use other editors as well and it's just engrained in their brains that how you comment and uncomment stuff. When new developers come, they have to learn these special shortcuts VS has.
For me the new shor cuts are horrible...
The most common actions are:
2. Format document
3. Comment / Uncomment
These should be faster than light.
In my opinion and experience, the new design slows production a lot.
Please change it by default!
Also, I am surprise that VS team dont have stats about shor cut usage by now...
With this information, you wouldn't have such bad design.
Daniel Comas Fernández commented
In the menu bar it should appear.
Why would this help? How much time does it take to press Ctrl-K-C??? Like 200 milliseconds.
Zhengzhong Zhang commented
That's great, some ide and editor use this shortcut. It would help people switch between vs and others freely.(And it would be better if it only consider //, the "/**/" is hard to uncomment and easy to make mistake)
Toggle comment with CTR+/ is exactly what I do (I think I made custom mapping to that)
I'd also love this feature. Sublime Text Editor has it and I seems to use it a lot.
There must be a short key of an icon to comment code. Its too much difficult to select from menu.
Michael Ganesan commented
Great idea, but I can live with the current feature. Not a problem.
Fine Nguyen commented
Horrible design. Please bring back 2008
To me it's not that the original shortcuts are difficult, I just prefer all of my shortcuts to be one modifier and one non-modifier key. My setup in vs2010 had alt + q and alt + e unbound, so I use alt + q and alt + e. This may not be for everyone but being used to playing games like WoW and others with tons of keybinds I love simple left hand ones.
Jeremy Schwartz commented
Good idea/bad idea - in probably most situations it would work fine, but as Adam points out the "on-off-on" scenario breaks expectations.
As long as this is an *additional* command, not replacing the others, I think it'd be great, because then you have 3 options to rebind to your liking. Then everyone is happy.
Dave Schinkel commented
Until VS gets it right some day and improves on some shortcuts like this...get ReSharper (Ctrl + Shift + /). While it has an extra Shift key, it's MUCH quicker still and easier than the default VS shortcuts you mentioned above. You'd be surprised how such a minor difference can be so much easier on your fingers. I agree that this Ctr + K + C and the variant with the U is way too much to do a simple comment/uncomment.
I completely agree! However it could be simplified even further....
In the case of AutoIt and the scite editor, you simply press the minus (-) key from the numerical keypad to denote lines as comments.
Yes, it is mentioned, several times: "Please add "CTR+/" shortcut for toggling comments." It's also in the title - "a... shortcut for commenting *and* uncommenting" (emphasis mine.) See also Konstantin's followup comments where this was made very clear.
I addressed Adam's scenario in my earlier comment. As I said, this functionality already exists in Xcode, a competing IDE. It works fine and would be nice to see in VS. I don't think anyone's asking for the existing commands to be removed! Just a new one added as well, with distinct functionality. If you didn't want to use it, you wouldn't have to.
You've missed the point of the suggestion Ali - this isn't about simply changing the shortcuts, which users can already do through the options.
This suggestion is for adding a *toggle* comment command, so that the same shortcut could both comment and uncomment lines. It works well enough in Xcode so it'd be nice to see in VS. I also don't think it would be *that* big a deal, just a nice little feature that would make coding slightly more pleasant.
Having started using Xcode for iOS development I've come to appreciate Cmd+/ for toggling the commented status of code lines. It's nice to have a single shortcut that does both, and their implementation seems intuitive.
FWIW the way it works there: if there's at least one uncommented line in the selection, all lines gain a //. Otherwise all lines lose a //. It only considers // and completely ignores /**/.
Hard to say but I suppose people use ctrl+shift+/ when caught in situations like this. But what is clear is that 3 people saw the thing in 3 different ways. Which is the right one?
ctrl+k+u and ctrl+k+c are clear on their task and absolutely predictable and when used to them, it take maybe 5/100th of a second longer than a single key shortcut.
Could you repro the sample provided by Adam but this time really using ReSharper?