Changing Ctrl + Tab behavior for moving between documents in Visual Studio - visual-studio

Is it possible to change how Ctrl + Tab and Shift + Ctrl + Tab work in Visual Studio? I have disabled the popup navigator window, because I only want to switch between items in the tab control. My problem is the inconsistency of what switching to the next and previous document do.
Every other program that uses a tab control for open document I have seen uses Ctrl + Tab to move from left to right and Shift + Ctrl + Tab to go right to left. Visual Studio breaks this with its jump to the last tab selected. You can never know what document you will end up on, and it is never the same way twice.
It is very counterintuitive. Is this a subtle way to encourage everyone to only ever have two document open at once?
Let's say I have a few files open. I am working in one, and I need to see what is in the next tab to the right. In every other single application on the face of the Earth, Ctrl + Tab will get me there. But in Visual Studio, I have no idea which of the other tabs it will take me to. If I only ever have two documents open, this works great. As soon as you go to three or more, all bets are off as to what tab Visual Studio has decided to send you to.
The problem with this is that I shouldn't have to think about the tool, it should fade into the background, and I should be thinking about the task. The current tab behavior keeps pulling me out of the task and makes me have to pay attention to the tool.

In Visual Studio 2015 (as well as previous versions of VS, but you must install Productivity Power Tools if you're using VS2013 or below), there are two new commands in Visual Studio:
Window.NextTab and
Window.PreviousTab
Just go remap them from Ctrl+Alt+PageUp/Ctrl+Alt+PageDown to Ctrl+Tab/Ctrl+Shift+Tab in:
Menu Tools -> Options -> Environment -> Keyboard
Note: In earlier versions such as Visual Studio 2010, Window.NextTab and Window.PreviousTab were named Window.NextDocumentWellTab and
Window.PreviousDocumentWellTab.

Visual Studio 2010 has, built in, a way to solve this.
By default, Ctrl+Tab and Ctrl+Shift+Tab are assigned to Window.[Previous/Next]..Document, but you can, through
Tools -> Options -> Environment -> Keyboard,
remove those key assignments and reassign them to Window.[Next/Previous]Tab to add the desired behavior.

it can be changed, at least in VS 2012 (I think it should work for 2010 too).
1) TOOLS > Options > Environment > Keyboard
(Yes TOOLS, its VS2012 !) Now three shortcuts to check.
2) Window.NextDocumentWindow - you can reach there quickly by typing on the search pane on top. Now this is your enemy. Remove it if you dont like it. Change it to something else (and dont forget the Assign button) if want to have your own, but do remember that shortcut whatever it is in the end. It will come handy later.
(I mean this is the shortcut that remembers your last tab)
3) Now look for Window.NextDocumentWindowNav - this is the same as above but shows a preview of opened tabs (you can navigate to other windows too quickly with this pop-up). I never found this helpful though. Do all that mentioned in step 2 (don't forget to remember).
4) Window.NextTab - your magic potion. This would let you cycle through tabs in the forward order. May be you want CTRL+TAB? Again step 2 and remember.
5) Now place cursor in the Press shortcut keys: textbox (doesn't matter what is selected currently, you're not going to Assign this time), and type first of the three (or two or one) shortcuts.
You'll see Shortcut currently used by: listed. Ensure that you have no duplicate entry for the shortcut. In the pic, there are no duplicate entries. In case you have (a rarity), say X, then go to X, and remove the shortcut. Repeat this step for other shortcuts as well.
6) Now repeat 1-5 for Previous shortcuts as well (preferably adding Shift).
7) Bonus: Select VS2005 mapping scheme (at the top of the same box), so now you get F2 for Rename members and not CTRL+R+R, and F7 for View Code and not CTRL+ALT+0.
I'm of the opinion VS has got it right by default. I find it extremely useful that VS remembers what I used last, and makes switching easier, much like what the OS itself does (on ALT+TAB). My browser does the same too by default (Opera), though I know Firefox behaves differently.

In Visual Studio 2012 or later (2013, 2015, 2017...):
Browse the menu Tools / Options / Environment / Keyboard.
Search for the command 'Window.NextTab', set the shortcut to Ctrl+Tab
Search for the command 'Window.PreviousTab', set the shortcut to Ctrl+Shift+Tab

Navigate to the blog post Visual Studio Tab Un-stupidifier Macro and make use of the macro. After you apply the macro to your installation of Visual Studio you can bind your favorite keyboard shortcuts to them. Also notice the registry fix in the comments for not displaying the macro balloon since they might get annoying after a while.

Ctl + Alt + PgUp or PgDn shortcuts worked to toggle next/prev tab out of the box for me...

After a couple of hours of searching I found a solution how to switch between open documents using CTRL+TAB which move from left to right and SHIFT+ CTRL+ TAB to go right to left.
In short you need to copy and paste this macro:
Imports System
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Public Module TabCtrl
Public Sub TabForward()
Dim i As Integer
Dim activateNext As Boolean = False
For i = 1 To DTE.Windows.Count
If DTE.Windows().Item(i).Kind = "Document" Then
If activateNext Then
DTE.Windows().Item(i).Activate()
GoTo done
End If
If DTE.Windows().Item(i) Is DTE.ActiveWindow Then
activateNext = True
End If
End If
Next
' Was the last window... go back to the first
If activateNext Then
For i = 1 To DTE.Windows.Count
If DTE.Windows().Item(i).Kind = "Document" Then
DTE.Windows().Item(i).Activate()
GoTo done
End If
Next
End If
done:
End Sub
Public Sub TabBackward()
Dim i As Integer
Dim activateNext As Boolean = False
For i = DTE.Windows.Count To 1 Step -1
If DTE.Windows().Item(i).Kind = "Document" Then
If activateNext Then
DTE.Windows().Item(i).Activate()
GoTo done
End If
If DTE.Windows().Item(i) Is DTE.ActiveWindow Then
activateNext = True
End If
End If
Next
' Was the first window... go back to the last
If activateNext Then
For i = DTE.Windows.Count To 1 Step -1
If DTE.Windows().Item(i).Kind = "Document" Then
DTE.Windows().Item(i).Activate()
GoTo done
End If
Next
End If
done:
End Sub
End Module
The macro comes from: www.mrspeaker.net/2006/10/12/tab-un-stupidifier/
If you never add a macro to Visual Studio there is a very useful link how to do it.

The philosophy of the Visual Studio tab order is very counterintuitive since the order of the displayed tabs differs from the tab-switching logic, rendering the ordering of the tabs completely useless.
So until a better solution arises, change the window layout (in Environment->General) from tabbed-documents to multiple-documents; it will not change the behaviour, but it reduces the confusion caused by the tabs.
That way you will also find the DocumentWindowNav more useful!

I'm 100% in agreement with Jeff.
I had worked on Borland C++ Builder for several years and one of the features I miss most is the 'correct' document tabbing order with Ctrl-Tab. As Jeff said, "The current tab behavior keeps pulling me out of the task and makes me have to pay attention to the tool " is exactly how I feels about this, and I'm very much surprised by the fact that there aren't many people complaining about this.
I think Ctrl-F6 - NextDocumentWindowNav - navigates documents based on the document's last-activated time. This behavior is a lot like how MDI applications used to behave in old days.
With this taken this into account, I usually use Ctrl+F6 to switch between 2 documents (which is pretty handy in switching between .cpp and .h files when working on c++ project) even when there are more than 2 currently opened documents. For example, if you have 10 documents open (Tab1, Tab2, Tab3, ...., Tab10), I click on Tab1 and then Tab2. When I do Ctrl+F6 and release keys, I'll jump to Tab1. Pressing Ctrl+F6 again will take me back to Tab2.

I guess you want what VSS calls Next(Previous)DocumentWindow. By default, it's on Ctrl(-Shift)-F6 on my VSS 8. On Ctrl(-Shift)-Tab they have Next(Previous)DocumentWindowNav. You can change key assignments via Tools/Options/Keyboard.

In registry branch:
HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\9.0
add DWORD named "UseMRUDocOrdering" with value of 1.
It will order documents so most recently used are placed on the left. It's not perfect but better than the default misbehaviour.

Updated to VS 2017+, where, according to #J-Bob's comment under #thepaulpage's answer, (emphasis added):
Looks like the commands have changed again. It's now 2017 and the keyboard shortcuts are called Open Next Editor and Open Previous Editor. You don't need any extensions for this.
You can find the options under Settings, which can be accessed via the gear symbol in the lower left, or by the [Ctrl]+, command.

I feel the top answer at the moment is outdated. In Visual Studio 2021 (v1.56), you do not need to install any extensions or mess around with any configuration files. You simply need to do the following steps:
Click the gear icon in the bottom-left.
Select 'Keyboard Shortcuts'.
Search for 'workbench.action.previousEditor' and 'workbench.action.nextEditor' and edit their keybindings by clicking the pencil icon on the left side of the row.
If you do change to 'Ctrl+tab' or any other shortcut that is already in use by another command, it will let you know and give you the option to change those. I personally changed them to 'Ctrl+PgUp' and 'Ctrl+PgDn' so it was just a straight swap.

I don't use Visual Studio (yes, really, I don't use it), but AutoHotkey can remap any hotkey globally or in a particular application:
#IfWinActive Microsoft Excel (application specific remapping)
; Printing area in Excel (# Ctrl+Alt+A)
^!a::
Send !ade
return
#IfWinActive
$f4::
; Closes the active window (make double tapping F4 works like ALT+F4)
if f4_cnt > 0
{
f4_cnt += 1
return
}
f4_cnt = 1
SetTimer, f4_Handler, 250
return
f4_Handler:
SetTimer, f4_Handler, off
if (f4_cnt >= 2) ; Pressed more than two times
{
SendInput !{f4}
} else {
; Resend f4 to the application
Send {f4}
}
f4_cnt = 0
return
These are two remappings of my main AutoHotKey script. I think it's an excellent tool for this type of tasks.

Related

Use Ctrl+Click to Select Word in VS Code

In Visual Studio, if you hold CTRL and click on word, it selects the entire word. If you drag, it selects text word-by-word.
I find this feature of Visual Studio very useful when I'm copy pasting small bits of code, since I can just keep holding CTRL, select words, and press C, X, or V to move stuff around.
In VS Code, you can't do this. Instead, CTRL+CLICK is bound to "Go To Definition".
Is there any way to match the behavior of VS Code with Visual Studio in this context?
As #phuzi said in the comments you can use double click to select the word or double click and drag to select word to word (it will snap on the last character of each word). If you triple-click on a line or click on line num, it will select the whole line (with the invisible character at last '\n').
If you press CTRL + D it will select the word where the cursor is. Also if there are multiple instance of same word you can select them all one after another using CTRL + D.
You can set multiples cursor by doing ALT+CLICK. You will then select multiples parts of your text/code that you could copy and paste very easily.
Using a keyboard hook, you could do something like this:
// release CTRL
INPUT input;
input.type = INPUT_KEYBOARD;
input.ki.wVk = VK_CONTROL;
input.ki.dwFlags = KEYEVENTF_KEYUP;
SendInput(1, &input, sizeof(input));
// double click in place
POINT client;
client.x = msStruct.pt.x;
client.y = msStruct.pt.y;
ScreenToClient(hWnd, &client);
const auto mouseLParam = MAKELPARAM(client.x, client.y);
SendMessage(hWnd, WM_LBUTTONDOWN, 0, mouseLParam);
SendMessage(hWnd, WM_LBUTTONUP, 0, mouseLParam);
SendMessage(hWnd, WM_LBUTTONDOWN, 0, mouseLParam);
SendMessage(hWnd, WM_LBUTTONUP, 0, mouseLParam);
// press CTRL
input.ki.dwFlags = 0;
SendInput(1, &input, sizeof(input));
I have implemented said feature and provided it as a free 3rd party open-source app: https://github.com/dougbenham/CtrlClick
Update for 2022. (Spoiler alert, it is still not here) but there are few catch:
Someone modded the source code
The only promising attempt I found is this attempt on github issue to modify vscode source code to support control click select.
But to really test this you need to be able to build vscode. At the time of writing, his commit is now 10 months old (10000 commits) behind latest and he did not provide any binary build, and I failed to build vscode from source myself so I cannot test this. (npm and yarn is not my domain here)
Which link to this code commit
Turning off ctrl+click for goto definition for now
Although not really a solution to what OP asked. I decided to include this in my answer as other answer did not mention it yet.
For now you can turn off this Ctrl+Click feature with workaround by setting following editor setting to 'ctrlCmd' so that it won't interfere with your copy paste action.
Side note & Background:
Note that I'm using Visual Studio Keymap because I'm still using VS for main development and don't want to lose shortcut I learned.
This extension already bring back VS F12 = 'Go to definition'
And many more such as CTRL+D for line dupe.
Thus this free up CTRLClick from 'Go to definition' because I already has F12 for that.
I also heavily used CTRLClick for 'whole word' selection and Ctrl-click-drag variant of it.
For any AutoHotkey users, here's a script that will give you the functionality (but not the +drag variant, unfortunately).
#IfWinActive ahk_exe Code.exe
~^LButton:: Send {LButton up}{Ctrl up}{Click}^{Left}^+{Right}
You'll still need to follow Wappenull's instructions to change Multi Cursor Modifier to 'ctrlCmd'.
The good thing about doing it this way is that you can use the same script for multiple programs.
I am the author of the source code change mentioned in the other reply. It appears my code will not be merged since it has been over a year.
My code changes can be found here if you want to build from source, but I also uploaded compiled binaries for Windows which can be downloaded in the Release tab.
If you build your own version you will need to modify product.json to get the Extension Gallery to work as described here. You can also install the extension Visual Studio Keymap to get similar key bindings to Visual Studio.
Once in Visual Studio Code you can enable the feature or add the JSON property:
"editor.wordSelection": true

Visual Studio 2015 - arbitrary cursor position on empty line

Initial note: I'm not getting any responses over on superuser to my question, so please allow me to ask this here:
I inherited a VS solution with a bunch of unorthodox settings. I'm not at liberty to wipe out all those settings and start over. So there is 1 setting I want to change back to VS default but cannot find it.
In a normal/default VS c# environment, when you click the mouse on a line of code that hasn't been written yet (empty, no spaces, no code, no tabs), the cursor automatically positions to the beginning of where the line of code should begin. If it's just inside a foreach, if, or etc, it will indent a bit from the left edge according to tab rules, etc.
But in the weird VS settings I have, wherever I click, the cursor positions at that exact spot. So if I click on col 20 of the next line, the cursor remains at col 20 rather than auto-repositioning to col 5 or wherever it should be. This is SO annoying because I can't always eyeball where the cursor should be and I end up clicking at the end of the previous line, then hitting ENTER, at which time it goes to the next line and positions the cursor at the right place.
How can I fix this?
It is controlled by the Enable virtual space option. See Visual Studio options - Text Editor - C#. By default it is off/unchecked.
I resolved this issue by applying Sergey's suggested change (Visual Studio options -> Text Editor -> C# -> Enable Virtual Space [check]), but also enabled (Options -> Text Editor -> C# -> Tabs -> Smart).

Changing all elements of highligthed type in visual studio

I use the Productivity Power Tools which highlights all the corresponding elements that are the same as the one being highlighted. As shown below ( "col-sm-6" - purple highlight )
(I think it is Productivity Power Tools doing this. I installed it the same time i upgraded to 2013 , not sure if it is a default setting now)
What I would really like to be able to do is to change all the elements that are highlighted at the same time. So if i want to change "col-sm-6" to "col-sm-4" I want to be able to just hold down a shortcut key which will change all items highlighted.
I have a very strong feeling that this functionality exists.
It seems a lot like the functionality used when you select multiply lines while holding "alt" and then typing.
I have searched around, but cannot seem to find a shortcut for this. I could just do a copy and replace but it would be a lot easier to just hold down "ctrl" while typing.
Yes, it does already exist. If you change a variable name, all the other instances can be renamed at same time (see below). Moment you change the name, a small red bar will be seen below the name -> press Ctrl and click on that bar; it will ask you to change all other instances.
Also, for highlighting a text; there is already a extension ti visual studio present, see here http://visualstudiogallery.msdn.microsoft.com/4b92b6ad-f563-4705-8f7b-7f85ba3cc6bb

Windows 7 Map CTRL + j to the Down Arrow Key

I have been searching for months for a way to map a key combination (CTRL + something) to a directional key (like down or up).
I desperately want in Visual Studio to be able to press CTRL + j and have the cursor move down a line. I hate having to move my hands off of the home row to move up and down for things like intellisense or even just navigating up and down lines.
Does anyone have a solution for this? I would be ok with a Visual Studio-only solution, but something that works at the OS level would be ideal since this kind of navigation would be nice in any editor window and for instance SQL Server Management Studio also has intellisense.
I haven't considered any macro hotkey type solutions since they could conflict with in-app hotkeys (for instance if CTRL+j were assigned to something in Visual Studio already)
I think the answer is nothing out there exists that would do this. I have done a lot of research.
I am now using Autohotkey instead of what would have been ideal. I have been familiar with this application for years and it does a pretty good job, but doesn't work across remote desktop for instance and so doesn't quite fill the need.
I mapped ctrl + i to do up, ctrl + k to be down, ctrl + j as left and ctrl + l for right.
VS-only solution is simple.
At least in Visual Studio 2017 you can assign Ctrl+XXX key combinations to corresponding commands for Text Editor.
CharLeft
CharLeftExtend
CharRight
CharRightExtend
LineUp
LineUpExtend
LineDown
LineDownExtend
PageUp
PageUpExtend
PageDown
PageDownExtend
LineStart
LineStartExtend
Delete
DeleteBackwards
WordPrevious
WordPreviousExtend
WordNext
WordNextExtend
and so on.
All using standard Tools / Options / Environment / Keyboard settings dialog.

Hidden Features of Visual Studio (2005-2010)?

Locked. This question and its answers are locked because the question is off-topic but has historical significance. It is not currently accepting new answers or interactions.
Visual Studio is such a massively big product that even after years of working with it I sometimes stumble upon a new/better way to do things or things I didn't even know were possible.
For instance-
Crtl + R, Ctrl + W to show white spaces. Essential for editing Python build scripts.
Under "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\Text Editor"
Create a String called Guides with the value "RGB(255,0,0), 80" to have a red line at column 80 in the text editor.
What other hidden features have you stumbled upon?
Make a selection with ALT pressed - selects a square of text instead of whole lines.
Tracepoints!
Put a breakpoint on a line of code. Bring up the Breakpoints Window and right click on the new breakpoint. Select 'When Hit...'. By ticking the 'Print a message' check box Visual Studio will print out a message to the Debug Output every time the line of code is executed, rather than (or as well as) breaking on it. You can also get it to execute a macro as it passes the line.
You can drag code to the ToolBox. Try it!
Click an identifier (class name, variable, etc) then hit F12 for "Go To Definition". I'm always amazed how many people I watch code use the slower right-click -> "Go To Definition" method.
EDIT: Then you can use Ctrl+- to jump back to where you were.
CTRL+SHIFT+V will cycle through your clipboard, Visual Studio keeps a history of copies.
Sara Ford covers lots of lovely tips: http://blogs.msdn.com/saraford/archive/tags/Visual+Studio+2008+Tip+of+the+Day/default.aspx
But some of my favourites are Code Snippets, Ctrl + . to add a using <Namespace> or generate a method stub.
I can't live without that.
Check out a great list in the Visual Studio 2008 C# Keybinding poster: http://www.microsoft.com/downloadS/details.aspx?familyid=E5F902A8-5BB5-4CC6-907E-472809749973&displaylang=en
CTRL-K, CTRL-D
Reformat Document!
This is under the VB keybindings, not sure about C#
How many times do you debug an array in a quickwatch or a watch window and only have visual studio show you the first element? Add ",N" to the end of the definition to make studio show you the next N items as well. IE "this->m_myArray" becomes "this->m_array,5".
Incremental search: While having a source document open hit (CTRL + I) and type the word you are searching for you can hit (CTRL + I) again to see words matching your input.
You can use the following codes in the watch window.
#err - display last error
#err,hr - display last error as an HRESULT
#exception - display current exception
Ctrl-K, Ctrl-C to comment a block of text with // at the start
Ctrl-K, Ctrl-U to uncomment a block of text with // at the start
Can't live without it! :)
Stopping the debugger from stepping into trivial functions.
When you’re stepping through code in the debugger, you can spend a lot of time stepping in and out of functions you’re not particularly interested in, with names such as GetID(), or std::vector<>(), to pick a C++ example. You can use the registry to make the debugger ignore these.
For Visual Studio 2005, you have to go to HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio \8.0\NativeDE\StepOver and add string values containing regular expressions for each function or set of functions you wish to exclude; e.g.
std::vector.*::.*
TextBox::GetID
You can also override these for individual exceptions. For instance, suppose you did want to step into the vector class’s destructor:
std::vector.*::\~.*=StepInto
You can find details for other versions of Visual Studio at http://blogs.msdn.com/andypennell/archive/2004/02/06/69004.aspx
Ctrl-F10: run to cursor during debugging. Took me ages to find this, and I use it all the time;
Ctrl-E, Ctrl-D: apply standard formatting (which you can define).
TAB key feature.
If you know snippet key name, write and click double Tab. for example:
Write
foreach
and then click tab key twice to
foreach (object var in collection_to_loop)
{
}
2. If you write any event, write here
Button btn = new Button();
btn.Click +=
and then click tab key twice to
private void Form1_Load(object sender, EventArgs e)
{
Button btn = new Button();
btn.Click += new EventHandler(btn_Click);
}
void btn_Click(object sender, EventArgs e)
{
throw new Exception("The method or operation is not implemented.");
}
btn_Click function write automatically
in XAML Editor, Write any event. for example:
MouseLeftButtonDown then click tab
MouseLeftButtonDown="" then click tab again
MouseLeftButtonDown="Button_MouseLeftButtonDown" in the code section Button_MouseLeftButtonDown method created.
Sara Ford has this market cornered.
http://blogs.msdn.com/saraford/default.aspx
More Visual Studio tips and tricks than you can shake a stick at.
Some others:
The Visual Studio 2005 and 2008 3-month trial editions are fully-functional, and can be used indefinitely (forever) by setting the system clock back prior to opening VS. Then, when VS is opened, set the system clock forward again so your datetimes aren't screwed up.
But that's really piracy and I can't recommend it, especially when anybody with a .edu address can get a fully-functional Pro version of VS2008 through Microsoft Dreamspark.
You can use Visual Studio to open 3rd-party executables, and browse embedded resources (dialogs, string tables, images, etc) stored within.
Debugging visualizers are not exactly a "hidden" feature but they are somewhat neglected, and super-useful, since in addition to using the provided visualizers you can roll your own for specific data sets.
Debugger's "Set Instruction Pointer" or "Set Next Statement" command.
Conditional breakpoints (as KiwiBastard noted).
You can use Quickwatch etc. to evaluate not only the value of a variable, but runtime expressions around that variable.
T4 (Text Template Transformation Toolkit). T4 is a code generator built right into Visual Studio
Custom IntelliSense dropdown height, for example displaying 50 items instead of the default which is IMO ridiculously small (8).
(To do that, just resize the dropdown next time you see it, and Visual Studio will remember the size you selected next time it opens a dropdown.)
Discovered today:
Ctrl + .
Brings up the context menu for refactoring (then one that's accessible via the underlined last letter of a class/method/property you've just renamed - mouse over for menu or "Ctrl" + ".")
A lot of people don't know or use the debugger to it's fullest - I.E. just use it to stop code, but right click on the red circle and there are a lot more options such as break on condition, run code on break.
Also you can change variable values at runtime using the debugger which is a great feature - saves rerunning code to fix a silly logic error etc.
Line transpose, Shift-Alt-T
Swaps two line (current and next) and moves cursor to the next line. I'm lovin it. I've even written a macro which changed again position by one line, executed line transpose and changed line position again so it all looking like I swapping current line with previous (Reverse line transpose).
Word transpose, Shift-Ctrl-T
When developing C++, Ctrl-F7 compiles the current file only.
Document Outline in the FormsDesigner (CTRL + ALT + T)
Fast control renaming, ordering and more!
To auto-sync current file with Solution Explorer. So don't have to look where the file lives in the project structure
Tools -> Options -> Projects and Solutions -> "Track Active Item in Solution Explorer"
Edit: If this gets too annoying for you then you can use Dan Vanderboom's macro to invoke this feature on demand through a keystroke.
(Note: Taken from the comment below by Jerry).
I'm not sure if it's "hidden", but not many people know about it -- pseudoregisters. Comes very handy when debugging, I've #ERR, hr in my watch window all the time.
Ctrl-Minus, Ctrl-Plus, navigates back and forward where you've been recently (only open files, though).
I don't use it often, but I do love:
ctrl-alt + mouse select
To select in a rectangular block, to 'block' boundaries.
As noted in comments,
alt + mouse select
Does just a plain rectangular block.
Here's something I learned (for C#):
You can move the cursor to the opening curly brace from the closing curly brace by pressing Control + ].
I learned this on an SO topic that's a dupe of this one:
“Hidden Secrets” of the Visual Studio .NET debugger?
CTRL + Shift + U -> Uppercase highlighted section.
CTRL + U -> Lowercase the highlighted section
Great for getting my SQL Statements looking just right when putting them into string queries.
Also useful for code you've found online where EVERYTHING IS IN CAPS.
Middle Mouse Button Click on the editor tab closes the tab.
To display any chunk of data as an n-byte "array", use the following syntax in Visual Studio's QuickWatch window:
variable, n
For example, to view a variable named foo as a 256-byte array, enter the following expression in the QuickWatch window:
foo, 256
This is particularly useful when viewing strings that aren't null-terminated or data that's only accessible via a pointer. You can use Visual Studio's Memory window to achieve a similar result, but using the QuickWatch window is often more convenient for a quick check.

Resources