Scott Hanselman

Visual Studio's most useful (and underused) tips

August 17, '16 Comments [104] Posted in VS2015
Sponsored By

There was a cool comment in my last blog post (one of many, as always, the comments > the content).

Btw, "until I realized that the Solution Explorer tree nodes are searchable." This one is a saver!

The commenter, Sam, noticed a throwaway bit in the middle of the post where I noted that the Solution Explorer was text-searchable. There's a lot of little tricks like this in Visual Studio that even the most seasoned developers sometimes miss. This phenomenon isn't limited to Visual Studio, of course. It's all software! Folks find non-obvious UX all the time in Windows, OSX, iPhone, everyday. If UX were easy then everything would be intuitive but it's not so it ain't. ;)

There's an old joke about Microsoft Office, which is known for having a zillion features.

"Most of the exciting new Office features you discover have always been in Office." - Me and Everyone Else

Here's some exceedingly useful stuff in Visual Studio (It's free to download and use, BTW) that folks often miss.

Search Solution Explorer with Ctrl+;

You can just click the text box above the Solution Explorer to search all the the nodes - visible or hidden. Or, press "Ctrl + ;"

Ctrl ; will filter the Solution Explorer

Even stuff that's DEEP in the beast. The resulting view is filtered and will remain that way until you clear the search.

Ctrl ; will filter the Solution Explorer and open subnodes

Quick Launch - Ctrl+Q

If there is one feature that no one uses and everyone should use, it's Quick Launch. Someone told me the internal telemetry numbers show that usage of Quick Launch in the single digits or lower.

Do you know that you (we) are constantly digging around in the menus for stuff? Most of you use the mouse and go Tools...Options...and stare.

Just press Ctrl+Q and type. Need to change the Font Size?

Find the Fonts Dialog quickly

Want to Compare Files? Did you know VS had that?

Compare Files

What about finding a NuGet package faster than using the NuGet Dialog?

image

Promise me you'll Ctrl+Q for a few days and see if you can make it a habit. You'll thank yourself.

Map Mode for the Scroll Bar

I love showing people features that totally surprise them. Like "I had NO IDEA that was there" type features. Try "map mode" in the Quick Launch and turn it on...then check out your scroll bar in a large file.

Map Mode for the Scroll Bar

Your scrollbar will turn into a thumbnail that you can hover over and use to navigate your file!

Map Mode turns your Scrollbar into a Scroll Thumbnail

Tab Management

Most folks manage their tabs like this.

  • Open Tab
  • Repeat
  • Declare Tab Bankruptcy
  • Close All Tabs
  • Goto 0

But you DO have both "pinned tabs" and "preview tabs" available.

Pin things you want to keep open

If you pin useful tabs, just like in your browser those tabs will stay to the left and stay open. You can not just "close all" and "close all but this" on a right click, but you can also "close all but pinned."

image

Additionally, you don't always have to double-click in the Solution Explorer to see what's in a file. That just creates a new tab that you're likely going to close anyway. Try just single clicking, or better yet, use your keyboard. You'll get a preview tab on the far right side. You'll never have more than one and preview tabs won't litter your tab list...unless you promote them.

Navigate To - Ctrl+, (Control+Comma)

Absolutely high on the list of useful things is Ctrl+, for NavigateTo. Why click around with your mouse to open a file or find a specific member or function? Press Ctrl+, and start typing. It searches files, members, type...everything. And you can navigate around with your keyboard before you hit enter.

There's basically no reason to poke around in the Solution Explorer if you already know the name of the item you want to see. Ctrl+, is very fast.

image

Move Lines with your keyboard

Yes I realize that Visual Studio isn't Emacs or VIM (unless you want it to be VsVim) but it does have a few tiny tricks that most VS users don't use.

You can move lines just by pressing Alt-up/down arrows. I've never seen anyone do this in the wild but me. You can also Shift-Select a bunch of lines and then Alt-Arrow them around as a group.

Move those lines with ALT-ARROW

You can also do Square Selection with Alt and Drag...and drag yourself a nice rectangle...then start typing to type on a dozen lines at once.

Perhaps you knew these, maybe you learned a few things. I think the larger point is to have the five to ten most useful features right there in your mind ready to go. These are mine. What are your tips?


Sponsor: Do you deploy the same application multiple times for each of your end customers? The team at Octopus have been trying to take the pain out of multi-tenant deployments. Check out their 3.4 beta release.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb
Wednesday, 17 August 2016 05:20:26 UTC
Very cool tips, I must confess I'm a little bit relieved that I in fact *did* know and use most of them, but the alt-drag-then-type thingy I didn't - and it's soooo convenient! Thanks for that!
-Tim
Tim
Wednesday, 17 August 2016 05:23:48 UTC
I've been using the alt line move trick for a couple of years now, so you're definitely not alone "in the wild". I also use the alt+click-drag to select vertical areas for typing, and have the "multiediting" extension for VS that gives you alt-click to drop multiple cursors throughout a file--replicating your keystrokes in multiple places. Extremely handy.
Wednesday, 17 August 2016 05:33:47 UTC
Thanks much ☺ for the wonderful tips, I never knew about few tips before 😊
Wednesday, 17 August 2016 05:37:30 UTC
Thank you for sharing this, the CTRL+q and CTRL+comma will be of immediate help!

Would have shared my tips like map mode scrollbar, but everything is already in this blogpost... I do hope some can come up with a tip to fully expand 1 node in solution explorer ;)
Wednesday, 17 August 2016 05:40:54 UTC
An additional trick with the map mode, is when you hover over the preview what it shows depends on where you hover.
The closer the cursor is to the actual code, the more detail you see.
If the cursor is all the way on the right you just see an overview of the nesting.
Mordechai Zuber
Wednesday, 17 August 2016 05:42:57 UTC
Very cool. I didn't know a few of them so great to learn something new :)

I also recently wrote a similar post on my blog. Surprisingly there aren't too many overlapping tips :) Just the one with Alt + drag. Hope it's ok to link my post
Wednesday, 17 August 2016 05:43:16 UTC
If you prefer to only use the keyboard, you can perform the Alt-Drag editing feature by holding down Alt-Shift and using the arrow keys. It's fun AND fast. :)
Wednesday, 17 August 2016 06:23:03 UTC
Well, after resharper i don`t care about what features vs has :)
Mihai Radulescu
Wednesday, 17 August 2016 06:24:46 UTC
CTRL+W to select the current word is so simple, yet one of my favorites. Repeat to expand the selection in a logical way.
I constantly find myself trying to use it in Code and even Word.
Wednesday, 17 August 2016 06:51:25 UTC
You can also use Square Select to in-place edit text, very useful if you want to change post- or prefix characters on multiple variables over multiple lines.

One of your evangelists did this in a demo at an Azure Bootcamp we hosted, and I bet for a few of them this was one of their biggest take-aways of the day :)
Henrik Walker Moe
Wednesday, 17 August 2016 07:03:28 UTC
I did know about alt+up/down before but I never used it so I forgot about it. Thanks for reminding me! Quick Launch though, never heard of. And it's sitting there basically attached to the minimize button...
Wednesday, 17 August 2016 07:04:48 UTC
Very nice! Love the vertical scrollbar, was always jealous of Sublime for that... Nice additions David Berry, too.
Greg
Wednesday, 17 August 2016 07:19:45 UTC
Nice. Especially the CTRL+<comma> is the most using search option for me.
Robert-Paul
Wednesday, 17 August 2016 07:24:08 UTC
Oooops, sorry. CTRL-W is a R# thing. *blush*
Wednesday, 17 August 2016 07:34:18 UTC
The Alt-<arrow> tip was great I usually did that with the mouse, not any more!

The solution explorer search thing I was a little puzzled why anyone would not know about that given it says right in the box "Search Solution Explorer (Ctrl-;)"

The map mode thing, I tried once, forgot about it, tried it again after reading this and then turned it off again, not that useful for me.
Peter
Wednesday, 17 August 2016 07:51:43 UTC
I was very surprised when my girlfriend (a Java programmer) showed me the "Sync with Active Document" button on the solution explorer. It has always been there I just never bothered to check what it does.
Wednesday, 17 August 2016 08:12:23 UTC
My most used shortcut is CTRL+T and CTRL+SHIFT+T for all in one search... Don't know if it's visual studio or ReSharper's feature though ;)
Wednesday, 17 August 2016 08:12:54 UTC
If you're used to Control-Comma (cannot live without it anymore), Control-; becomes somewhat superfluous but it has its use nevertheless.
Marius
Wednesday, 17 August 2016 08:13:17 UTC
A nice feature of the map mode scroll bar is that errors from build or static analysis are highlighted on it with red squares. You can click the scroll bar on or next to them to jump straight to where the problem is.

I like using the full screen view (Shift-Alt-Enter toggles it) when I want to focus on coding. It gets rid of everything but the menu bar and tabs. There seems to be a bug with it though. If VS is not maximized it works fine; the Windows taskbar is hidden and VS fills the screen. But if VS is maximized the Windows taskbar remains visible but the height of the full screen VS window is calculated as if it was so a little is cut off top and bottom.
Wednesday, 17 August 2016 08:26:27 UTC
Forgot to ask: do you guys have any issues with lagging behaviors when using Control-Comma?

Often, the first keystroke gets eaten. I.e. "Control-; foo" becomes "oo" typed in the completion thingy. When this happens the screen flashes. After that it's OK for a while but can happen again in the same VS session.

Also, when typing quickly, chars tend to become swapped as the insertion cursor in the completion thingy doesn't catch up quickly enough. So "foo" can be typed in as "ofo" sometimes, or even "oof".

Another annoyance is that the using the mouse on the completion results sometimes selects the wrong file. This happens when using Control-comma as a surrogate for Control-;

Say I want all XYZ.xml files. Control-, XYZ presents DIR1\XYZ.xml ... DIRn\XYZ.xml, clicking on DIR3\XYZ.xml often opens/previews DIR2\XYZ.xml. Using the arrows is fine though.

A part from the annoyances, it's a time-saving feature without which navigating a large solution project becomes quickly undoable and remains an absolutely essential features.

Thanks for that!
Marius
Wednesday, 17 August 2016 08:38:22 UTC
Wow!!!! Thanks for sharing.
Satyabrata Mohapatra
Wednesday, 17 August 2016 09:03:53 UTC
If you're working on 'enterprise' code where class has an interface. Ctrl+F12 to take you to the implementation is a sanity saver.

My most successful tip has been for SQL Management Studio. You can configure (New Connection Dialog -> Options) different DB connections to show a different colour in the status bar. Green-Dev, Orange-Test, Prod-Red.

Dined out for a week on that one when I showed it to a new team that was struggling to make sure they were in the right environment. It's not mine, a SQL guru showed me once.
Simon Needham
Wednesday, 17 August 2016 09:10:49 UTC
I'm a really heavy user of pinned tabs and generally only "close all" tabs when I'm switching between issue branches. You can make it much more usable by turning on "Show pinned tabs in a separate row" - find the option by CTRL+Q, pinned.

I notice from your screenshots that you've got line numbers turned on. That's a setting I always get people to turn on when they ask for my help looking at their code. I can't understand why it isn't turned on by default.

@Mihai Radulescu Resharper is great, but I'd prefer to use built-in features if they are at least as good as those of Resharper, because that way I can still use them if I ever have to use a copy of Visual Studio without Resharper.
Wednesday, 17 August 2016 09:14:13 UTC
@jmrjr - Asterisk '*', it's a windows-wide shortcut for treeviews, so also works on Explorer folders, etc.
Simon
Wednesday, 17 August 2016 09:18:53 UTC
My favorite one is paste special. Which allows us to copy json or XML and paste it as a c# class

Edit=>Paste Special=>Paste JSON As Classes
Umamaheswaran
Wednesday, 17 August 2016 09:26:32 UTC
Here's goes another that is specially useful when you are into a new project and trying to find your way around. Sometimes you open a new file/tab and keep moving around the solution explorer it's easy to get lost when you select the tab again and it's location it's not visible in the solution explorer. To "fix" this:

Tools -> Options ->Projects and solutions -> Track Active item in solution explorer

or Ctrl + Q start typing... track

Have fun.
Mário
Wednesday, 17 August 2016 09:31:26 UTC
@Marius You can try disabling the preview tab, see if that helps with performance. To do this:
- hit Ctrl + ,
- click on the little arrow on the right of the search box
- at the bottom of the menu, you'll see a "Search options" section
- uncheck the See Preview Tab
Paul
Wednesday, 17 August 2016 09:33:16 UTC
Want to Compare Files? Did you know VS had that?
The option visible on the screenshot is just to show the toolbar for comparison. I don't see any option there to literally compare two files (toolbar itself doesn't give that). Am I missing something?
It works seamlessly when using any integrated VCS when committing files or comparing them between commits and that's cool, but has nothing to do with Ctrl-Q which is great by the way.

I like the list anyway, because I like that kind of "hacks" which can make developers life easier. For example I like the fact that you can search for references in Solution Explorer Search. It saved me some time once in the past.
Ireneusz Patalas
Wednesday, 17 August 2016 09:40:25 UTC
@Ireneusz Patalas Indeed, the option shown in the screenshot only shows/hides the "Compare File" toolbar. If you want to actually see a diff between two files, besides comparing files in your VCS, you can open the command window (Ctrl+Alt+A), and type

> Tools.DiffFiles File1.cpp File2.cpp
Paul
Wednesday, 17 August 2016 09:47:35 UTC
Found this the other day - you can define search folder groups to use in the 'find in files' dialog, e.g. a group that excludes resource projects, or vendor provided JS files, or excludes secondary projects and just includes the code project items.
Marc
Wednesday, 17 August 2016 09:49:26 UTC
@Paul: thx! That's a good thing to know :)
Ireneusz Patalas
Wednesday, 17 August 2016 10:30:30 UTC
Dear Mr.Sccot,

May I know why Microsoft has not created an AngularJS 2 template project inside VS.NET ?. We are really need to just create and have a full prepared Hello word App in less than a minute.

Wednesday, 17 August 2016 10:37:57 UTC
Very helpful tips thanks
Ahmed
Wednesday, 17 August 2016 10:42:14 UTC
hi i love c# and using visual studio. good post
Wednesday, 17 August 2016 11:16:26 UTC
Visual Studio's Control+Comma and then immediately followed by Control+V does not work.

But Resharper's Control+T and then immediately Control+V does...

So if you want to paste what you want to search, you are out of luck... your only option is to use Resharper.
Rosdi
Wednesday, 17 August 2016 11:24:25 UTC
Funny that, I as a Senior Developer am careless to know all these but co-op students (colleagues) are passionate to use all these and more everyday. I can see they are fast in productivity.

Good post
Addisu Desta
Wednesday, 17 August 2016 11:30:41 UTC
Thanks for the tips! I knew most of these but have not made a good habit of using them, unfortunately. One thing that your tip on tabs made me think of pointing out is that the Visual Studio Productivity Power Tools include an option for a "Vertical Tab-Well" which, after switching to it, I could never go back. It's so much cleaner and easier to find open files. I also think it's a more efficient use of space but obviously it's personal preference. I highly recommend all VS devs give it a try. I cringe when I get stuck using horizontal tabs!
Tom
Wednesday, 17 August 2016 12:00:34 UTC
There's also Search inside Tools -> Options, if you made it as far as to open it before being overwhelmed with confusion. I think we can subtitle this post "my god, it's full of search".

And like Tom, I'm a big fan of the Vertical tab well in the Power Tools. The only things I don't like is that I can't adjust the tab width independently in different splits, or swap one split back to horizontal tabs to minimize dead space if I only have a few tabs open.
Jesper
Wednesday, 17 August 2016 12:14:45 UTC
My most frequently used

Ctrl-Tab - brings up the window browsing thingy.

F8 - "next thing in the list", where list is whatever has focus - error list, find symbol results etc. SHIFT-F8 to go back one.
Philip Daniels
Wednesday, 17 August 2016 12:29:36 UTC
A useful shortcut I've learned recently:
ALT + - (dash), opens the context menu of the tab like you right clicked in the tab title.
Johann Josefy
Wednesday, 17 August 2016 12:32:07 UTC
This is great stuff! I was keeping a list of similar tips at visualstudiotipsandtricks.com, but probably need to update it for the new stuff in the latest release.
Wednesday, 17 August 2016 12:35:39 UTC
Thanks Scott! The group line move is dope! I'll probably have to pick just one or two and learn them. Ctrl+, seems like it would serve me best. I mostly just Ctrl+F everywhere.

Is there a shortcut to change the search mode to "current document"? A constant tussle is accidentally searching the entire solution when I've set the mode to that in a previous search.

I can't think of any shortcuts to share, I must be all mouse! :)
Wednesday, 17 August 2016 12:47:17 UTC
It's always nice to remember these useful tips.
Luiz Gustavo
Wednesday, 17 August 2016 12:49:48 UTC
I'm just waiting for VS Code to support Alt+drag rectangular selection. It always annoys me having to switch to Geany or VS just to edit multiple lines at once!
Wednesday, 17 August 2016 13:56:03 UTC
Good tips. I'm going to give the map mode scrollbar a try.

I know it's not baked into VS by default, but the GoToDefinition VS extension (Ctrl+click to drill into any class/property/method/etc, including JS) I stumbled upon a couple years ago was life-changing for me. I navigate around so much more quickly and efficiently. As a GUI oriented guy I used to right-click, Go to Definition, but this extension allows me to skip by the context menu and/or having to reach up to the F12 key and gives me an intuitive "you're about to navigate here if you click" visual cue while I'm holding the Ctrl key and hovering over various classes, methods, and properties.
Wednesday, 17 August 2016 14:00:48 UTC
I love Alt+up/down and use it all the time, except it has broken every application that is not Visual Studio...I often find myself in SSMS for example trying to figure out why Alt+Up isn't working, haha.

Another tip is that you can select text from multiple lines and then start typing. For example:

Foo.Bar.FirstName = "Bob";
Foo.Bar.LastName = "Smith";

Can be changed to:
Foo.Bar.Person.FirstName = "Bob";
Foo.Bar.Person.LastName = "Smith";

by placing your cursor at Foo.Bar and pressing Alt+Shift+Down and then typing .Person (You'll see .Person being typed on both lines)
Wednesday, 17 August 2016 14:55:03 UTC
Hi Scott,

Just wondering what do you use to record the GIFs like the last one in this article?

Thanks!
Liam O'Neill
Wednesday, 17 August 2016 14:57:36 UTC
I use the Alt-up/down arrows all the time. It's my favorite feature!
Chris
Wednesday, 17 August 2016 15:13:06 UTC
A tip for getting to a tip: right-click your code window scrollbar to easily navigate to the scrollbar options.
Jonathan
Wednesday, 17 August 2016 15:34:18 UTC
@Liam, I don't know what Scott uses. But I use ScreenToGif. I've tried quite a few Gif maker/capturers and this is the best (free) one I found.
Mike Sigsworth
Wednesday, 17 August 2016 15:38:01 UTC
Its ultimate
Thx
Naresh
Wednesday, 17 August 2016 17:24:20 UTC
This is really cool. I never knew some of the features mentioned existed in ( especially the column edit ) by VS.
peacock_rider
Wednesday, 17 August 2016 17:26:37 UTC
Great post Scott! I love the "Map Mode" for the scroll bar. One other really nice feature, which I found totally by accident when trying your "MOVE LINES WITH YOUR KEYBOARD", is that without selecting anything and pressing Alt+Down or Alt+Up it will scroll to next/previous property defined in your class. Pretty nifty!
Wednesday, 17 August 2016 17:29:48 UTC
CTRL+K+D to layout-format your code (if you get it from somewhere else, or a template with weird indentation or something)

and the edit - paste special option to paste JSON or XML on the clipboard as C# classes... that was a cool surprise when someone showed me that!
Wednesday, 17 August 2016 18:02:19 UTC
"MOVE LINES WITH YOUR KEYBOARD"

I discovered this fairly recently and use it ALL THE TIME now to reorganize my code. It's super handy when combined with collapsible code when you want to quickly rearrange the order of the members in a big class.
Nick
Wednesday, 17 August 2016 18:29:01 UTC
@Alistair Chapman
vs code has vertical editing (ctrl+alt+shift+ up/down). It's a few keys yes, but works.

It also has the multiple cursors too

Regards,
Ike
Ike
Wednesday, 17 August 2016 18:40:35 UTC
CTRL + M followed by CTRL + O will quickly collapse your class methods to make it a bit easier to move around. I use this all the time.
Davin Studer
Wednesday, 17 August 2016 18:41:52 UTC
Nice! I've never been a VS guy but the more I follow your posts and podcasts the more intrigued I become. I am a die hard IntelliJ user and most/all of these niceties are also this IDE. (I should do an equivalent post in IntellJ/Android Studio!) while I've long belt that IntelliJ was the BEST IDE of all time I have to say I have have been giving VS a second look. I work in VS Code these days. Do you have tips for Code as well?
Wednesday, 17 August 2016 20:06:19 UTC
shift-alt-select is great when you need it.
Wednesday, 17 August 2016 20:15:27 UTC
Ctrl+shift+alt+Up/Down: move function/property/member up/down
Michael Brown
Wednesday, 17 August 2016 20:55:14 UTC
Complete list of Visual Studio Shortcuts... http://visualstudioshortcuts.com/2015/
Thursday, 18 August 2016 01:52:15 UTC
No one seems to be using CTRL+- or CTRL+SHIFT+-. This lets you navigate backward/forward to your last cursor position.
Roger
Thursday, 18 August 2016 02:41:36 UTC
just learned ctrl+shift+a today for add new file to current folder
rory
Thursday, 18 August 2016 03:38:10 UTC
@Rosdi Ctrl+, followed by Ctrl+V totally works for me. Maybe Resharper broke it for you? :trollface:
Kent
Thursday, 18 August 2016 04:29:02 UTC
I just learned yesterday
Ctrl + Enter -> 'O' in vim
Ctrl + Shift + Enter -> 'o' in vim
Ctrl + Shift + L -> 'dd' in vim
Thursday, 18 August 2016 04:55:46 UTC
Thanks for finally talking about > Visual Studio's most useful (and underused) tips
- Scott Hanselman < Loved it!
Thursday, 18 August 2016 05:04:46 UTC
Some work in vs code also
Dude
Thursday, 18 August 2016 05:26:00 UTC
With pining, do yourself a favour and rebind pin to ctrl-p

Anyone who prints their source code out should be shot :) especially if you need print as a hotkey


Keith Nicholas
Thursday, 18 August 2016 05:37:36 UTC
@Alastair Chapman

In response to ALT-DRAG in vscode

VS Code has the more superior feature of multiple cursors which allow multiple line editing, but on every line you can put your cursor in a different spot if you want

or if you want a block quickly

CTRL-ALT-Down Arrow

then type!

Esc to get rid of them

Or with mouse SHIFT-ALT select an area, it's quite flexible
Keith Nicholas
Thursday, 18 August 2016 05:56:16 UTC
My fave and most used is:
ctrl + [ + s

It highlights and brings into view the currently active file in the Solution Explorer.
Sanvir Manilal
Thursday, 18 August 2016 06:44:46 UTC
I don't think the pinned tab/preview tab tab management solution works very well; the not-so-great declare tab bankruptcy works better in an unfortunately large number of scenarios.

It takes time and thought to pick pinned tabs, and in particular in means you know fairly early on which tabs are likely to be relevant to your current edit. In that one scenario - pinned tabs work - great! use em!

But there are many edits I make where I a priori do not know exactly what I need to change where in the codebase; e.g. you might discover something to change and you follow the changes as dictated by "if I change this type here, what miscompiles?". And during such an editing sequence it emerges that one or two files are central to unravelling the spagetti; whereas others that seem relevant turn out not to be.

I'd much rather have the feature "auto-kill all (possibly unpinned) tabs without unsaved changes that are not on the top N (e.g. 50) most recently used". Or really, any semi-sane heuristic for separating "important" from "stale" tabs while keeping the number open limited. Closing the wrong tab isn't a huge problem as long as the last few you viewed aren't the ones killed.
Thursday, 18 August 2016 08:31:17 UTC
Hat-tip here to Rockscroll, which started the whole map-mode thing anyway.
And I heard of that here, for - what was it - VS2010 or something?

(Nope, just checked, VS2005 and VS2008!)

http://www.hanselman.com/blog/IntroducingRockScroll.aspx
Karkow
Thursday, 18 August 2016 11:25:51 UTC
I watch so many devs highlighting words or chunks of code slowly with their mouse it drives me nuts. Simple shortcuts that have been there forever, but seem to be rarely used:

Ctrl + LeftClick = highlights the whole word under the cursor(as does double-LeftClick)

Ctrl + ] = With caret before a bracket, it leaps to the matching bracket

Ctrl + Left/Right Cursor = Move caret to start or end of word

Hold down the shift key while doing this and you quickly highlight words and code chunks much faster and more accurately than messing around with your mouse.

I lament the sad death of Quick Macros in recent VS versions. Knowing all the keyboard shortcuts and being able to do quick record & playback loops was a huge timesaver. I had to go out and learn to use AutoHotKey to replace this & I still miss it..
Martin
Thursday, 18 August 2016 12:34:38 UTC
CTRL+R,R turns on Rename mode, so you can rename an identifier and see all the changes in live preview.

Once I started using CTRL+Q, I have no more need of the toolbars or the menu bar (with the Hide Main Menu extension).
Zev Spitz
Thursday, 18 August 2016 13:19:10 UTC
Alas, for those of us doing Compact Framework projects still stuck with VS2008, none of these goodies are available. Thank goodness that things are moving towards Xamarin and away from CF!
David Mikesell
Thursday, 18 August 2016 15:04:32 UTC
You can use Alt+mouse drag to select a range of columns and rows (similar to the old style of selection on a console host window). Once selected, you can delete or insert or replace any text in the selection area at the same time, allowing you to modify whole blocks of text together (to, say, insert spaces, or change a value across multiple rows).
Josh Pactor
Thursday, 18 August 2016 15:05:44 UTC
thanks mr hanslman , nice shortcuts :) .
Thursday, 18 August 2016 15:06:36 UTC
My personal favorite tips:
Ctrl+i, then start typing (followed by F3, as necessary) = quickest way to search through the current document.

Ctrl+Shift+V = cycling through the clipboard "ring". I use this especially if I want to swap two items: copy itemA, copy itemB, Ctrl+Shift+V over itemA, then Ctrl+Shift+V+V over itemB = swapped.
Thursday, 18 August 2016 16:55:24 UTC
Ctrl+K, C - Comment out selected
Ctrl+K, U - Uncomment out selected

Use this all the time, and is context aware - it'll use // in a .cs file, <!-- --> in XML, and config files.

Same commands in Sql Management Studio too.
Tyler Free
Thursday, 18 August 2016 17:57:52 UTC
I knew about the alt+up/down one. It is my favourite thing in Eclipse (along with ctrl+alt+up/down to duplicate selected lines), and I had been adding it to Visual Studio with plugins until they finally built it in. It's a real time saver ;)
José Ernesto Lara Rodríguez
Thursday, 18 August 2016 18:06:47 UTC
In VSCode, Sublime, and Atom,

Ctrl+D
is Add Selection To Next Find Match

Its quite handy, I hope this can be added to VS.
Jojo Aquino
Friday, 19 August 2016 03:20:03 UTC
@Kent,

You are right.... Ctrl+, brings up Recent Files (a R# feature) in my VS... lol... my mistake... thanks for pointing that out..
Rosdi
Friday, 19 August 2016 08:05:09 UTC
That's pretty cool to be honest! I was trying out the map mode feature and found out something amazing - say if you are working on a large file and having trouble scrolling up and down to see what other methods do or for some reason wish to be able to see a section of the code whilst you are working on some other section of the code in that class, you can now split the view into two halves.

To do this, in map mode view to the right, you'll find an arrow at the very top of the map mode, drag this arrow to the bottom and voila!, you can now see two separate sections of the same class!

Now this same feature is also available in the bar mode if you weren't already aware :)
Sachin
Friday, 19 August 2016 08:35:07 UTC
I wasn't aware of Ctrl-; (despite it being clearly marked - but then others missed Quick Launch) and I'd forgotten Ctrl-I

How about a blog post on "most annoying feature for Visual Studio" which would probably answer most of the niggles: changing the default search options especially for Selection would be high on my list, and how to replace Ctrl-F2-Tab-Tab-Down with a single keystroke for what-is-that-called-anyway.
amacabama
Friday, 19 August 2016 10:00:05 UTC
File browser in DPack is much more better than Ctrl+;

Martin
Friday, 19 August 2016 15:42:37 UTC
Is there a way to search a string inside a specific type of file? For example, if I'm searching a project using Ctr-F and I know the value is inside a XML file, it would be very useful to only search XML files, and not js, htm, txt, and every other file type inside the solution.
Alex Freitas
Friday, 19 August 2016 15:58:58 UTC
Definitely underused!
Thanks for the insight Scott!
VisualPro
Friday, 19 August 2016 19:59:02 UTC
I loved the Alt+Arrow one, its really cool and useful and did not have any idea that it exist.
Ali Al-Mosawi
Friday, 19 August 2016 22:39:52 UTC
I love the Quick Search! Can you give any insight on how it is implemented? I'd love to include something similar in our applications.
Chris
Saturday, 20 August 2016 11:08:07 UTC
Great tips... always good to re-remember stuff :) One of my favourites is ALT+F12, if you are on an object it will give you an inline view of the class or method you are calling. Great if you are trying to get grips on a solution you've been handed over.

Ryan
Saturday, 20 August 2016 12:24:10 UTC
Great post, I started using these tips, and coding goes easier.
There is a feature I hope if it was there: when I click a varible/field/ method, etc, all occurrences of it appear highlighted on the scroll bar, just like when I search them using Find/Replace window.
If I can do customized settings to enable it, please tell me how.
Thanks
Mohamed
Sunday, 21 August 2016 11:47:25 UTC
I like to re-map the Navigate To feature to CRTL + SHIFT + T, as we don't have resharper and that was one of the most used features for me.

Also Remove and Sort references is great, although I think you need to map that using the Keyboard options.
Stuart Clark
Sunday, 21 August 2016 14:26:24 UTC
Great tips, thanks a lot Scott!
Max Studio
Tuesday, 23 August 2016 00:37:19 UTC
One of my favorites when coding:

Surround With
Ctrl+K, Ctrl+S
Wednesday, 24 August 2016 02:38:25 UTC
I like to break lines at a certain line length, and I often need to merge two lines into one.

Before I used to hit Ctrl + Shift + ArrowRight repeatedly to select the text to the next line including white-space, and hit Backspace.

Now I found that Ctrl + Delete or Ctrl + Backspace does that trick for me.
Bart Verkoeijen
Wednesday, 24 August 2016 15:06:40 UTC
Wow, I can't believe you read my comment and gave us another great post ! This really make my day !
Sam Lin
Thursday, 25 August 2016 12:01:23 UTC
Scott have to agree there are tons of "unkown" features which we rarely use. Guess most are discovered by accident if you can. I admit i didnt know about QUICK LAUNCH - CTRL+Q shortcut.
Thursday, 25 August 2016 12:25:46 UTC
I don't think anyone yet has mentioned View/Navigate Backwards: Ctrl+'-'

That's one I use all the time. Typical use case:

- You're working on some code and want to look up a definition so you hit f12 and the buffer changes to that definition (which could be in the same file or another)
- Hit Ctrl+'-' to go back to where you were.

Also useful if you need to 'push to the stack' by navigating elsewhere (eg adding an include file) and then use this shortcut to pop the stack to get back to where you were.
Paul Walmsley
Wednesday, 31 August 2016 20:12:24 UTC
Here's a set that I try to teach to our new hires:

Pinned files in their own row (settings)

Use the alt + enter menu when available (rename suggestions etc)

ctrl + f12 > go to implementation (so glad this got introduced in one of the updates)
ctrl + k + d > format document
ctrl + D > duplicate line
ctrl + tab/ctrl + shift + tab > switch recent files
ctrl + upArrow/downArrow > scroll page up/down without moving cursor
alt + shift + up/down block highlighting
ctrl + m + o > collapse all (ctrl + m + l > invert collapsed state)
ctrl + m + m > toggle collapsed state of function
ctrl + k + c > comment
ctrl + k + u > uncomment

turn on line numbers for all files
turn on white space characters

use the mouse less, it takes a little bit but you'll get faster.
Kevin
Friday, 02 September 2016 07:30:08 UTC
very useful tips :)
Rasshme
Friday, 02 September 2016 16:01:35 UTC
great post man thanks..
Friday, 02 September 2016 16:02:20 UTC
great post admin..
Monday, 05 September 2016 13:27:41 UTC
useful post

xender for pc
Monday, 05 September 2016 15:27:24 UTC
very useful
xender for pc
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.