Shortcut to change which statement is executed next - visual-studio-2010

When debugging in Visual Studio, I can change the line of next execution by dragging the yellow arrow to the desired line.
Is it possible to put the cursor on a line and use a shortcut to do this instead of dragging?

I'm using Visual Studio 2008 at the moment, but this can be done by right-clicking on the source and selecting "Set Next Statement" from the popup menu. I would be surprised if this has been removed from VS2010.
If that's not short enough for you, you can go into "Tools" -> "Customise" and set up a keyboard shortcut to the "Debug.SetNextStatement" command. On my current setup (perhaps not the default), you can press CTRL+SHIFT+F10.

Related

What's the purpose of this arrow icon in the left margin / breakpoint bar in Visual Studio? [duplicate]

What does the following arrow icon mean in the Visual Studio 2012 gutter window? I've never seen it before.
This particular line of code has nothing special about it, nor do I recall doing anything to this line that would cause an arrow to appear. It's definately attached to this line of code. Moving the line of code down causes the arrow to follow.
I have no add-ons installed in Visual Studio.
It marks a Task List shortcut. You add them with Edit > Bookmarks > Add Task List Shortcut, [Ctrl+E,T] keystroke. That adds an entry to the task list, use View > Task List to display it. Select "Shortcuts" in the combobox. You'll see a list of all the shortcuts you added. Double-click an entry to jump to the line.
Remove it again with Edit > Bookmarks > Remove Task List Shortcut, [Ctrl+E,T] again.
NOTE: In visual studio 2015 and above, its [Ctrl+K,Ctrl+H]

Visual Studio: Shortcut to close window not working

I changed the shortcut to close a window to Ctrl+W and to close all windows to Ctrl+Shift+W. Close all windows works fine, but Ctrl+W selects the word currently under the cursor but does not close the window.
When I right-click a tab it say Ctrl+W is the shortcut to close it (And also Ctrl+S to save and Ctrl+Shift+W to close all). Why is only the close window shortcut not working?
In Visual Studio (VS 2015 in my case but it's similar down to VS 2010 at least) keyboard shortcuts may have a different meaning depending on the context in which they are executed.
Click Tools / Options / Environment / Keyboard to look up or define shortcuts (you already did that probably). What I called "context" is selected in the combobox labelled "Use new shortcut in:". Most likely you defined the shortcut in "Global" but you want it to work in "Text Editor". In the latter Ctrl+W selects the current word.
Redefine Ctrl+W for "Text Editor" and you should be fine.
I am using Visual Studio 2017 & Visual Studio 2019 and tried the answer from #TobiMcNamobi but it didn't work for me. After few such tries I got it work with below steps.
You should add it as Global shourtcut otherwise it will not work for Designer views.
Add CTRL+W as a Global shortcut for Window.CloseDocumentWindow
Remove the CTRL+W shortcut for Edit.SelectCurrentWord
In Visual Studio 2019 it is Ctrl-F4 by default to CloseDocumentWindow. The action is Window.CloseDocumentWindow. I know this is old but the accepted answer has you change the short-cut key instead. I would rather use the default option.
Tools -> Options -> Environment -> Keyboard
If you're ever unsure go to the path above and you will see the image above then you can click inside the box "Press shortcut key" at the bottom of the form and type the short cut key you're interested in and it will tell you if it is used and what it is currently used for.
You can also reference the docs
https://learn.microsoft.com/en-us/visualstudio/ide/default-keyboard-shortcuts-in-visual-studio?view=vs-2019
2021: For Visual Studio 2019:
See: https://gist.github.com/jpoehls/2030795#gistcomment-2335647
In my case, I had to existing assignments that I had to remove. Thereafter, I could use the hotkey.
In my case, the tabs were not closing because I am using Vim extension. I had to add the following lines to Vim settings:
"vim.handleKeys": {
"<C-w>": false
}
Just press Ctrl + , or Command + , for Mac users, search for Vim and go into Edit in settings.json as the following picture shows:
Screenshot
For Visual Studio 2022, make sure you also remove Ctrl+W from selectCurrentWord command.
In my VS Pro 2019, on Tools / Options / Environment / Keyboard, the first line offers using a premade keyboard mapping scheme, with a drop-down option for VSCode keyborad mapping theme.
I picked it and it seems to have adopted the keyboard shortcuts I was used to from working on VSCode, Ctrl+W included.
For those using linux with VSCode v1.56.2,
File --> Preferences --> Keyboard Shortcuts.
Search for View:Close Editor and as mentioned above, remove any keybinding that has the keybinding you want.

Visual Studio shortcut for "quick fix"

Does Visual Studio 2010 have a shortcut for quick fix?
I'm tired of grabbing the mouse, hovering over this red line, waiting for the little clipboard icon to appear, clicking on the first menu item. It would be so much fast to just open that dialog with some keys and confirming the first (i.e. selected) item.
The feature is called the "Smart Tag".
Default Keyboard Shortcut Schemes (ReSharper documentation)
Stack Overflow question How does one set Visual Studio 2010 keyboard shortcuts comfortably, especially when using ReSharper?
Stack Overflow question Visual Studio keyboard shortcut to automatically add the needed 'using' statement
They can usually be invoked via the keyboard using either:
Ctrl+. (on a standard QWERTY keyboard)
Alt+Shift+F10 (if you've not got Function Lock enabled)
If your cursor is on the item that is underlined, you can use Ctrl + . to pop up the intellisence/suggestion context menu.
Alt + Shift + F10 does the trick.
Via #Rohit from Visual Studio keyboard shortcut to automatically add the needed using statement
If you want to edit the shortcut of quick fix you can do the following:
Open Tools->Options->Keyboard and in the Show commands containing field enter EditorContextMenus.CodeWindow.QuickActionsForPosition and replace the old shortcut with the new one.

Select code window after compiling

When I am working on a project and compiling all the time, it gets very annoying having to select the code window with the mouse each time after compiling, is there a keyboard shortcut in visual studio to select the code window?
Back when I used Visual Studio, the F4 key went to the next error location in the code and automatically selected the code window. Also try Esc. I think the "next error" keystroke is different in more current versions of VS, so use whatever your keyboard mapping offers.
If you press Alt+W, then Visual Studio opens a list with open windows. You can then select the number corresponding to the window you want to activate. For example, Alt+W,1 activates the first window in the list.

How to open header file (.h) in visual studio 2005

I'm tired of right clicking on the header file in c++ and choosing open document "blahblah.h"
Is there a keyboard shortcut?
I don't have VS 2005 installed anymore, so I can't guarantee it, but in 2008 you don't need a macro or VA-X for this (though you certainly want Visual Assist X if you don't have it). I don't recall much change in this for quite a while, so I'd expect it to work in VS 2005 as well.
Select Customize... from the Tools menu. Click on the Keyboard button at the bottom left corner of the dialog that comes up. In the "Show Commands Containing" field, type in "header". One of the commands that shows up should be something like "EditorContextMenus.CodeWindow.GotoHeaderFile". Select that. In the Press Shortcut Keys field, press the keys you want to use to open the header file.
You need to use Visual Assist or write a macro.
http://www.alteridem.net/2008/02/26/visual-studio-macro-to-switch-between-cpp-and-h-files/

Resources