Visual Studio IDE Visual Studio for Mac Visual Studio Code. To continue downloading, click here. Visual Studio Codespaces 2021-03-19T12:32:41-07:00. GitHub Codespaces. Access cloud-hosted dev environments from Visual Studio Code or your browser. Learn more about GitHub Codespaces.
-->You can navigate in Visual Studio more easily by using the shortcuts in this article. These shortcuts include keyboard and mouse shortcuts as well as text you can enter to help accomplish a task more easily.
For a complete list of command shortcuts, see Default keyboard shortcuts.
Note
- If you want to easily duplicate a line of code in Visual Studio Code, you can do it with a simple keyboard shortcut. Just use the Copy Line Down ( Ctrl+Alt+UpArrow ) or Copy Line Up commands ( Ctrl+Alt+DownArrow ) — depending on where you want the new line inserted with respect to your cursor.
- Visual Studio shortcut keys. A handy shortcut key reference to make your.NET lifestyle easier and more productive. The most important shortcuts are highlighted in red, like so: Shortcut.
- Duplicate Line or Selection. Edit Duplicate Line or Selection Ctrl+D. One of the ways of creating a code element similar to an existing one (for example, a new method overload or a new auto-implemented property) is cloning the existing element with copy-paste and then editing the clone.
- Using Microsofts Visual Studio Code, how do I duplicate a line of code and then move it up and down? (Similar to how Sublimes cmd+shift+d). It's a feature that I use constantly, and am struggling using Visual Studio Code without it.
This topic applies to Visual Studio on Windows. For Visual Studio for Mac, see Common keyboard shortcuts in Visual Studio for Mac.
Window management
Task | Shortcut |
---|---|
Maximize floating window | Double-click on title bar |
Maximize/minimize windows | Win+Up arrow / Win+Down arrow |
Redock floating window | Ctrl+double-click on title bar |
Move/dock floating windows | Win+Left arrow / Win+Right arrow |
Close active document | Ctrl+F4 |
Show open file list | Ctrl+Alt+Down arrow |
Show all floating windows | Ctrl+Shift+M |
Show jump list | Win+Alt+N |
Start new instance | Win+Shift+N |
Switch between windows | Win+N |
![Visual Studio Mac Duplicate Line Visual Studio Mac Duplicate Line](https://www.scio.de/wp-content/uploads/2018/01/AndroidProject-Manifest.png)
Search
Task | Shortcut |
---|---|
Solution Explorer search | Ctrl+; |
Place focus in search box in any tool window (except editor) | Alt+` when the tool window has focus |
Search Visual Studio | Ctrl+Q |
Search box results filter | @opt - Options @cmd - Commands @mru - Most recently used @doc - Open documents |
Search in Tools Options | Ctrl+E |
![Duplicate Duplicate](https://s33046.pcdn.co/wp-content/uploads/2020/06/aws-explorer-1.png)
Find in the editor
Task | Shortcut |
---|---|
Quick Find | Ctrl+F |
Quick Find Next Result | Enter |
Quick Find Previous Result | Shift+Enter |
Quick Find Expand Drop Down | Alt+Down arrow |
Dismiss Find | Esc |
Quick Replace | Ctrl+H |
Quick Replace - Replace Next | Alt+R |
Quick Replace - Replace All | Alt+A |
Find in Files | Ctrl+Shift+F |
Replace in Files | Ctrl+Shift+H |
Code editor
Task | Shortcut |
---|---|
Go To All | Ctrl+T |
Go to recent files | Ctrl+T,R |
Multi-caret multiple insertion points | Ctrl+Alt+click |
Multi-caret add matching selection | Shift+Alt+Ins |
Format Document | Ctrl+K,D |
IntelliSense suggestion mode | Ctrl+Alt+Space (Toggle) |
Force show IntelliSense | Ctrl+J |
Quick Actions | Ctrl+. |
Snippet picker | Ctrl+K,X or ?,Tab (Visual Basic) |
Surround With | Ctrl+K,S |
Show Quick Info | Ctrl+K,I |
Navigate To | Ctrl+, |
Navigate highlighted references | Ctrl+Shift+Up (Previous) Ctrl+Shift+Down (Next) |
Editor zoom | Ctrl+Shift+> (In) Ctrl+Shift+< (Out) |
Block selection | Hold Alt and drag mouse Shift+Alt+Arrow keys |
Move line up/down | Alt+Up arrow / Alt+Down arrow |
Duplicate line | Ctrl+E,V |
Expand selection | Shift+Alt+= |
Contract selection | Shift+Alt+- |
Go To Definition | F12 |
Peek Definition | Alt+F12 |
Go To Definition stack | Ctrl+Shift+8 (Back) Ctrl+Shift+7 (Forward) |
Close the Peek Definition window | Esc |
Promote the Peek Definition window to a regular document tab | Ctrl+Alt+Home |
Navigate between multiple Peek Definition windows | Ctrl+Alt+- and Ctrl+Alt+= |
Navigate between multiple Peek results | F8 and Shift+F8 |
Toggle between the code editor window and the Peek Definition window | Shift+Esc |
Go to enclosing block | Ctrl+Alt+Up arrow |
Go to next/previous issue | Alt+PgUp / Alt+PgDn |
Contextual navigation menu | Alt+` |
Toolbars
Task | Shortcut |
---|---|
Add buttons | Select the toolbar overflow button |
Find combo in standard toolbar | Ctrl+D |
Find textbox command mode | Type > |
Create new alias | Type alias <new alias> <command> in the Command window |
Debugging
![Microsoft visual studio mac Microsoft visual studio mac](https://ksr-ugc.imgix.net/assets/005/635/527/fd779175a66c6db8ba0f9035b2fc568b_original.jpg?ixlib=rb-2.1.0&w=680&fit=max&v=1459537365&auto=format&gif-q=50&q=92&s=4c6d4b324f26cefd519cb85620b7a640)
Task | Shortcut |
---|---|
Start debugging | F5 |
Stop debugging | Shift+F5 |
Restart debugging | Ctrl+Shift+F5 |
Step over | F10 |
Step into | F11 |
Step out | Shift+F11 |
Run to cursor | Ctrl+F10 |
Set next statement | Ctrl+Shift+F10 |
Set and toggle breakpoint | F9 |
Disable breakpoint | Ctrl+F9 |
Immediate window | Ctrl+Alt+I |
Immediate window command mode | Type > |
Immediate window - clear buffer | Type cls |
Immediate window - print value | Type ?varname |
Visual Studio Mac Python
See also
Visual Studio Mac Vs Windows
Shortcut | Description |
---|---|
Ctrl-XorShift-Delete | Cuts the currently selected item to the clipboard. Without selection it cuts the entire line to the clipboard. |
Ctrl-CorCtrl-Insert | Copies the currently selected item to the clipboard. Without selection it copies the entire line to the clipboard. |
Ctrl-VorShift-Insert | Pastes the item in the clipboard at the cursor (with selection in clipboard), or at the next line (with line in clipboard). |
Ctrl-ZorAlt-Backspace | Undo previous editing action |
Ctrl-YorCtrl-Shift-Z | Redo the previous undo action |
Ctrl-Shift-VorCtrl-Shift-Insert | Pastes an item from the clipboard ring tab of the Toolbox at the cursor in the file and automatically selects the pasted item. Cycle through the items on the clipboard by pressing the shortcut keys repeatedly |
Ctrl + .orShift+Alt+F10 | Opens smart tag and resolves a wide array of suggested code refactorings |
Esc | Closes a menu or dialog, cancels an operation in progress, or places focus in the current document window |
Ctrl-S | Saves the selected files in the current project (usually the file that is being edited) |
Ctrl-Shift-S | Saves all documents and projects |
Ctrl-P | Displays the Print dialog |
F7 | Switches from the design view to the code view in the editor |
Shift-F7 | Switches from the code view to the design view in the editor |
F8 | Moves the cursor to the next item, for example in the TaskList window or Find Results window |
Shift-F8 | Moves the cursor to the previous item, for example in the TaskList window or Find Results window |
Shift-F12 | Finds a reference to the selected item or the item under the cursor |
Ctrl-Shift-G | Opens the file whose name is under the cursor or is currently selected |
Ctrl-/ | Switches focus to the Find/Command box on the Standard toolbar |
Ctrl-Shift-F12 | Moves to the next task in the TaskList window |
Ctrl-Shift-8 | Moves backward in the browse history. Available in the object browser or Class View window |
Alt-Left Arrow | Go back in the web browser history |
Alt-Right Arrow | Go forward in the web browser history |
![](https://cdn-ak.f.st-hatena.com/images/fotolife/r/ruriatunifoefec/20200910/20200910011341.png)