Editor:
Alt + Shift + arrow keys Allows you to make a block selection.
Ctrl + tab Switches open windows forward.
Ctrl + Shift + tab Switches open windows backwards.
Ctrl + Space visual Studio gives the possible completions.
Ctrl + ] For matching braces and parentheses. Note: this also works for @if(){} in a view.
Ctrl + Shift + ] Selects code between matching parentheses.
Ctrl + M To expand/collapse the current code block.
Ctrl + / Will take the cursor to the small search box on top.
You can type ">of filename" to open a file.
Very useful if your project contains multiple files.
Ctrl + I Incremental search.
It is a find dialog box, but without the dialog box.
Just start typing what you want to search for
(look at the bottom status bar location to see what you've typed).
Pressing Ctrl + I again or F3 searches for the next instance.
Press Escape to quit.
Starting a new search by pressing Ctrl + I twice repeats the last search.
Ctrl + Shift + V paste / cycle through the clipboard ring
Shift + Alt + Enter Gets the code window in focus in full screen mode.
Hit it again, and you have all the panels back.
F12 Go to function
ctrl + comma Navigate to
ctrl + minus Navigate backwards
ctrl + shift + minus Navigate forwards
ctrl + k, ctrl + t View call hierarchy
Debug:
F5 Start debugging
ctrl + F11 Step into
ctrl + F10 Step over
shift + F11 Step out
ctrl + F10 Run to cursor
ctrl + shift + F9 or Menu: Debug -> Delete All Breakpoints
Wrapping a block of code with div:
To wrap a block of code with a div element:
Select block of code > right click to open context menu > 'select Wrap With <div>' or (Shift-Alt-W)
Eg: wrapping a block of code with div, preserving formatting:
Other useful shortcuts:
To close all files but one:
right click the tab of the file you want to leave open then click 'Close All But This'
To close a file:
ctrl + F4:
To add comment:
ctrl k, then ctr c (chord is a combination of keyboards)
To uncomment:
ctrl k, then ctr u
To switch to zoom:
ctrl + middle mouse button
To navigate to a view's controller from the view:
Right click on view > Go To Controller
Or use keyboard shortcut ctrl-M, ctrl-G
Eg:
Recovering deleted file(s) in visual studio:
Files are permanently delete in Visual Studio. However, you can recover them in your Recyle Bin.
For more information, see here.