Visual Studio For Mac Key Bindings

As I was working today, I noticed that I don’t know much keyboard shortcuts in Visual Studio for Mac. So I’ve decided to collect all of them, add some unknown and share them with you. At the end of this article, you can find a link to the pdf in which all of them are written. One more thing to add before we begin. In Visual Studio for Mac preferences, under Key Bindings section, you can choose the Scheme of key bindings. You can select the scheme from this list.

Visual Studio Code Preview for Mac Default Key Bind - Visual Studio Code Preview for Mac Default Key Bind. // Overwrite key bindings by placing them into your key. Once installed, Visual Studio for Mac will prompt you to personalize your installation by signing in and selecting the key bindings that you'd like to use: If you have network trouble while installing in a corporate environment, review the installing behind a firewall or proxy instructions. Learn more about the changes in the release notes.

This post will be about the first one: “Visual Studio”

Find references

Sometimes you just need to find the references of the specified object. In this case, simply press

Cmd + Shift + R or Shift + F12

and this will happen:

Go to declaration

Whenever you want to go to the object/type declaration press

Cmd + mouse click or F12 or Cmd+D

Toggle breakpoint

When having a cursor in a line just press

Cmd + or F9

so the breakpoint will appear.

Enable/Disable breakpoint

In case you want to disable/enable this breakpoint simply press

Cmd + Alt + / or Cmd + F9

Step into

When the breakpoint is hit and you want to step into the definition simply press

Shift + Cmd + I

Step over

Maybe you want to go to the next line of code? No problem

Shift + Cmd + O / F10

Step out

Do you want to step out of function? No problem:

Shift + Cmd + U

Continue debugging

Or maybe you just want to continue the program without further debugging?

Cmd + enter

So let’s imagine your code get’s wrongly formatted. As long as C# code is not that big problem, wrongly formatted
XAML files can be pretty painful.

Format document

So whenever you want to format your code just press

Ctrl + I

Indent/Unindent section

You want to indent/unindent the section? Easy

Cmd + ]

Unindent section

Cmd + [

Rename

Whenever you want to rename the field/variable/property/whatever and do it once so it will auto-update elsewhere.
Simply press:

Cmd + R

Toggle line comment

When you want to either format one line of code, or a whole block of code then simply select the code and press

Cmd + /

Toggle fold

This one is simply complicated but works fine. You can still edit this shortcut!

Visual Studio For Mac Key Bindings Usb

Cmd + Shift + Alt + left arrow

Change file

When quickly navigating between opened files simply press

Ctrl + tab

and navigate through the list with Tab button. If you want to cancel the selection press ESC

Close all files

How many times did you have a situation when too many files were opened? In this case, when you want to close
them all simply press.

Cmd + Shift + W

Close file

On the other hand when you want to close only one file:

Cmd + W

Add files to project

That’s kind nice one, as opening the context menu, and choosing “Add files” is quite time-consuming. In case
you want to add files to project, select the folder to which you want to add the file and

Alt + Cmd + A

Build project

Just a shortcut for building a project.

Cmd + K / Shift + F6

Build all

Similar to the one above but builds the whole solution

Cmd + B / F6

Clean

Clean the project Mac torrent websites.

Cmd + Shift + K

Start debugging

Just for a quick start the project🙂

Cmd + Enter / F5

Quick fix

When having an error or warning simply click on it and press

Alt + Enter

Find

Just a standard find option in the document

Cmd + F

Find next

When having search bar opened

Cmd + G / F3

Show the intellisense

When you want to show the intellisense

Ctrl + Space

Go to line

That’s interesting on. Who knows to which line he want’s to go?! :O

Cmd + L

Replace in files

Another way of changing the names in files but in my opinion more dangerous than
Ctrl + R

Cmd + Alt + F

Rectangle selection

That’s quite a good tool, but it has limitations. Nice to use it with modifiers.

Visual Studio For Mac Key Bindings Download

hold Alt+ select with a mouse

Move line of code

Sometimes you just want to move the line of code 2 lines up/down. You can probably cut the whole line, go to
the chosen place and paste. You can do it quicker.

hold Alt + navigate up/down with up/down arrow

Go to the beginning/end of the line

These are nice mac shortcuts for navigating through texts. Works on Mac, not only in VS for Mac.

Cmd + left arrow/right arrow

Go to the beginning/end of a document

Similar to the one above but navigates vertically.

Cmd + arrow down

Two editor column

That’s something for people who have big displays and like to have as much code as possible on their’s display.

Cmd+Alt+2

One editor column

And that’s for getting back to the standard view 🙂

Cmd+Alt+1

Zoom in/zoom out

In case you have a prelection/you want to show your code on the display you might want to adjust the font size
by pressing

Bindings

Cmd + “+” or ”-”

That’s almost all 🙂Besides the samples about, I’ve also created the .pdf file with all shortcuts in one place. You can download it from
here. If I missed something or if you know other useful shortcuts please let me know in comments!

-->

You can identify keyboard shortcuts for Visual Studio commands, customize those shortcuts, and export them for others to use. Many shortcuts always invoke the same commands, but the behavior of a shortcut can vary based on the following conditions:

  • Which default environment settings you choose the first time that you open Visual Studio—for example, General Development or Visual C#. (For information about changing or resetting your settings, see Environment settings.)

  • Whether you've customized the shortcut's behavior.

  • Which context you're in when you choose the shortcut. For example, the F2 shortcut invokes the Edit.EditCell command if you're using the Settings Designer and it invokes the File.Rename command if you're using Team Explorer.

Visual Studio Mac Keyboard Shortcuts

Regardless of settings, customization, and context, you can always find and change a keyboard shortcut in the Options dialog box. You can also look up the default keyboard shortcuts for several dozen commands in Popular keyboard shortcuts. For a complete list of all default shortcuts (based on the General Development settings), see All keyboard shortcuts.

If a shortcut is assigned to a command in the Global context and no other contexts, that shortcut will always invoke that command. But a shortcut can be assigned to one command in the Global context and a different command in a specific context. If you use such a shortcut when you're in the specific context, the shortcut invokes the command for the specific context, not the Global context.

Note

Your settings and edition of Visual Studio might change the names and locations of menu commands and the options that appear in dialog boxes. This page is based on the General Development settings profile.

Identify a keyboard shortcut

  1. On the menu bar, choose Tools > Options.

  2. Expand Environment, and then choose Keyboard.

  3. In the Show commands containing box, enter all or part of the name of the command without spaces.

    For example, you can find commands for solutionexplorer.

  4. In the list, choose the correct command.

    For example, you can choose View.SolutionExplorer.

  5. If the command has a keyboard shortcut, it appears in the Shortcut(s) for selected command list.

Customize a keyboard shortcut

  1. On the menu bar, choose Tools > Options.

  2. Expand Environment, and then choose Keyboard.

  3. Optional: Filter the list of commands by entering all or part of the name of the command, without spaces, in the Show commands containing box.

  4. In the list, choose the command to which you want to assign a keyboard shortcut.

    In the Use new shortcut in list, choose the feature area in which you want to use the shortcut.

    For example, you can choose Global if you want the shortcut to work in all contexts. You can use any shortcut that isn't mapped (as Global) in another editor. Otherwise, the editor overrides the shortcut.

    Note

    You can't assign the following keys as part of a keyboard shortcut in Global:

    • Enter, Tab, Caps Lock
    • Print Scrn/Sys Rq, Scroll Lock, Pause/Break
    • Insert, Home, End, Page Up, Page Down
    • The Windows logo key, the Application key, any of the Arrow keys
    • Num Lock, Delete, or Clear on the numeric keypad
    • The Ctrl+Alt+Delete key combination
  5. In the Press shortcut key(s) box, enter the shortcut that you want to use.

    Note

    You can create a shortcut that combines a letter with the Alt key, the Ctrl key, or both. You can also create a shortcut that combines the Shift key and a letter with the Alt key, the Ctrl key, or both.

    If a shortcut is already assigned to another command, it appears in the Shortcut currently used by box. In that case, choose the Backspace key to delete that shortcut before you try a different one.

  6. Choose the Assign button.

    Note

    If you specify a different shortcut for a command, click Assign, and then click Cancel to close the dialog box, the shortcut you assigned is not reverted.

Share custom keyboard shortcuts

You can share your custom keyboard shortcuts by exporting them to a file and then giving the file to others so that they can import the data.

To export only keyboard shortcuts

  1. On the menu bar, choose Tools > Import and Export Settings.

  2. Choose Export selected environment settings, and then choose Next.

  3. Under What settings do you want to export?, clear the All Settings check box, expand Options, and then expand Environment.

  4. Select the Keyboard check box, and then choose Next.

  5. In the What do you want to name your settings file and Store my settings file in this directory boxes, either leave the default values or specify different values, and then choose Finish.

By default, your shortcuts are saved in a file in the %USERPROFILE%DocumentsVisual Studio 2017Settings folder. The name of the file reflects the date when you exported the settings, and the extension is .vssettings.

By default, your shortcuts are saved in a file in the %USERPROFILE%DocumentsVisual Studio 2019Settings folder. The name of the file reflects the date when you exported the settings, and the extension is .vssettings.

To import only keyboard shortcuts

  1. On the menu bar, choose Tools > Import and Export Settings.

  2. Choose the Import selected environment settings option button, and then choose Next.

  3. Choose the No, just import new settings, overwriting my current settings option button, and then choose Next.

  4. Under My Settings, choose the file that contains the shortcuts that you want to import, or choose the Browse button to locate the correct file.

  5. Choose Next.

  6. Under Which settings do you want to import?, clear the All Settings check box, expand Options, and then expand Environment.

  7. Select the Keyboard check box, and then choose Finish.

Visual Studio 2019 Shortcut Keys

See also