Five shortcuts to boost your productivity
Taking full advantage of the Visual Studio editor features will make you a more productive developer. Any keyboard warrior will tell you that knowing the right shortcuts boosts that productivity even further. So, we’ve put together a short little video that demonstrates some useful shortcuts you can use while coding in Visual Studio.
In the video, we cover the following shortcuts:
|Ctrl + D||Duplicate lines|
|Ctrl + Shift + L||Delete whole line|
|Shift + Alt + .||Select next occurrence|
|Alt + select||Vertical (box) selection|
|Alt + Ctrl + mouse-click||Insert multiple cursors|
There are many other features for editing your code. One way to discover them is to look in the Edit menu.
Is there any shortcut to select the whole string (everything between double quotes)? I’ve tried both expand selection options in the screenshot but they select much more than I want.
double click on it
it selects only single word. sometimes it’s necessary to select the whole phrase (with spaces) in quotes. I use mouse in this case.
Triple click selects whole sentence
This does not respect double quotes, selects entire line.
Have you tried Edit.ExpandSelection? For me it is Shift+Alt+=
Or what file are you editing?
Tools –> Environment –> Keyboard
if pressed multiple times, it selects more things in the current line.
example: (if your curser is between the mm)
var text = “hh-mm-ss”;
1. selects mm
2. selects hh-mm-ss
3. selects “hh-mm-ss”
4. selects var text = “hh-mm-ss”
I use Shift-Delete to remove lines, although it actually cuts them into the clipboard. Great when refactoring code and lines of code need to move.
Alt-Up and Alt-Down to move the current line or selected lines up or down are similarly great.
I used to use Shift+Delete until I learned about Shift+Ctrl+Delete. Most of the time, I do not wish the deleted line overriding my clipboard.
Alt+up/down is a lifesaver too. Don’t know how I could have forgot to put that in the video 🙂
Windows clipboard history (Win+V) helps somewhat there.
OT: Will Visual Studio ever get a mayor rewrite so that it matches the performance of e.g. Rider? I still cannot believe that a Java application is actually so much faster and so much more responsive than a Windows application.
Good tips! It would be nice if the full screen option worked on the embedded YouTube player.
In flagship Visual Studio 2022 for Windows, what’s the shortcut to turn-on the line length guidelines (the one that marks, for example, an 80 character line) in the editor?
Not out of the box, but this Extension does it – https://marketplace.visualstudio.com/items?itemName=PaulHarrington.EditorGuidelinesPreview
What about Ctrl + Shift + (Left/Right) Arrow? I use it a lot when positioning multiple carets in different length named properties. Or simply to faster select method name or faster horizontal navigation.
btw. In table could be the full command name used in Options/Keyboard (eg. Edit.InsertNextMatchingCaret = Select next occurence) in case someone would like to change it or the default one is unmapped for some reason.
Sorry by the sidestep: I use Visual Studio 2022 preview. Today it started spell checking variable names and giving hundreds of spell check warnings.
In this blog on the image that shows the shortcuts (Edit/Advanced) theres an opcion for toggle spell check. I don’t have that option.
My instal is up to date. How can i toggle spell check?
Does this help? https://devblogs.microsoft.com/visualstudio/visual-studio-spell-checker-preview-now-available/ 🙂