“Keyboard shortcuts in Visual Studio for Mac” is one of my most popular articles. Many people read it both on my blog and on Medium. After almost 2 years, it’s time to write something similar. This time, let’s see what kind of shortcuts do you have in Rider.

Because I use Mac for my development I will write about Rider for Mac. I assume the shortcuts are similar on Windows, but you need to check on your own.

This article will focus on Visual Studio OSX keymap. You can check what keymap you have selected in Preferences -> Keymap

Keymap settings

Before we start

If you are still reading this article then it probably means that you are also using Rider for development. Let me give you one tip before we even start.

From Rider’s Marketplace, install Key Promoter X. As the author of the plugin says: “A plugin to learn the IntelliJ IDEA shortcuts.”. What it basically does is that every time you use your mouse to do something in Rider, it shows you a toast with information what is the shortcut for the action that you just performed.

Key Promoter X pop up

Simple and very helpful to learn Rider shortcuts.

In order to install the plugin:

  1. Press Cmd + , (cmd + coma)
  2. The “Preferences” should open
  3. Go to “Plugins”
  4. From top bar select “Marketplace”
  5. Type “Key Promoter X” in the search bar.
  6. Select the first one and click “Install”
  7. Voilá!

Shortcuts

Now let’s get to the proper content of this blogpost. Shortcuts. In each shortcut, there will be a short description of behaviour, shortcut and a gif showing what it does (if possible). So let’s go!

Writing code

Show context actions

Alt + enter

So you are writing a piece of code. unfortunately, something is wrong. Code is underlined. The colour is either red, yellow or green. Fortunately, Rider can take care of all colours. If something is underlined, simply use the following shortcut and choose the proper action.

Context actions

Search everywhere

Cmd + t

The shortcut I use most often. You wanna what you are looking for but don’t know where in solution it is? Search for it! Useful for finding classes, methods, properties and much more!

Search everywhere

Find in path

Cmd + shift + f

So you know there a commented code somewhere but you don’t exactly know where. No problem, just use find in path option and find what you were looking for

Find in path

Replace in path

Cmd + shift + h

Let’s assume, you are a joker and you want to replace all occurrences of “//TODO” with “//Please, remove me” (don’t know why you would like but who cares… except your teammates who would probably kill you after this joke). With a single shortcut, you can replace all of them. Beware, after you press enter you will change currently selected line to provided text, so you’d better not use this function as a search.

Replace in path

Find usage

Shift + f12

Sometimes you just need to find the references for the specified class/method/property. Just press the shortcut and navigate to proper code!

Go to declaration

Cmd + mouse click // F12

Whenever you want to go to the class/method/property declaration press

Go to declaration

Cmd + F12

This is pretty useful when ending up in the interface. By pressing Cmd + F12 you can end up in this method implementation.

Duplicate selected code

Cmd + d

No further explanation needed. Just see how it works.

Move line of code

Alt + Shift + Arrow up/arrow down

Sometimes you just want to move a line code above or below another line. This can be easily achieved with

Delete line of code

Cmd + shift + l

Sometimes you don’t want to move a line of code. You want to remove the whole line. Go ahead!

Delete line of code

Comment/uncomment

Cmd + k + c

I would say this is a pretty standard function. Who didn’t comment whole class or whole method? If you want to do so, select it and press

comment/uncomment code

Refactor

Format code

Cmd + k + d

Just a simple code format. It will format code accordingly to your IDE settings, so go there to adjust those if you want to. In order to change them, go to Preferences (CMD+, ) -> Editor -> Code Style -> C#.

format code

Rename

Cmd + r + r

Sometimes it happens that you just want to rename something. It does not matter what you want to change. After you are done, press enter to rename it.

rename

Multiline selection

Alt + mouse selection

I don’t know how to name it, so please remember shortcut, and take a look at git.

Refactor this

Cmd + shift + r

This is an option that I use because I am lazy to remember all shortcuts that are available in the refactor method. If you want to refactor something, start with opening Refactor context menu by pressing

Now pick what you want to do

Code cleanup

Cmd + e +c

This is a magic function that cleans up your code withing selected scope. If you don’t want to do everything manually maybe it’s worth giving it a try?

Navigation-related

Let’s be honest: Rider is a pretty powerful IDE. It has many pads which can do a lot of stuff.

There is one single trick for navigation between those tabs.

views numbers

If you take a close look at this screenshot, most of the views have “magic” numbers next to them eg. 1: Explorer, 2: Favorites, 3: Find etc. What most people don’t know is those are the numbers to open those view. You just need to combine the number with CMD.

In order to open:

  • Solution view: CMD+1
  • Favorites view: CMD+2
  • Find view: CMD+3
  • TODO view: CMD+6
  • NuGet view: CMD+7
  • Unit Tests view: CMD+8
  • Repository view: CMD+9

This should make your navigation easier. Maybe you will be able not to use a mouse

Select opened file

Alt + F1 (does not work for me)

Having many files in your solution tree, sometimes it takes very long to navigate to the opened file. With this command, you should easily do it.

You should because this shortcut does not work for me – I have to do it manually. You need to press this button

show file in solution tree

Collapse solution tree

Cmd + – (Cmd + minus)

When you have multiple folders opened in your solution tree you can press Cmd + - to collapse whole tree.

NOTE: you need to be in Solution view to use this command. When being in code, it will take you back to the place you visited previously.

collapse tree

Close all views

Ctrl + shift + F12

Sometimes during development, your IDE can become pretty messy. With a single keyboard combination, you can clean it!

hide all views

Close current window

Cmd + F4

This is a pretty useful Rider shortcut if you want to close the current window.

Changing window

Ctrl + tab

Similar to changing apps on Mac, you can change the opened file. It’s simple and you don’t have to use a mouse!

changing opened window

and change the selection by pressing it again.

Warning: moving the selection with arrows does not work

Add new file

Cmd + n

If you are at the beginning of your project, it’s worth knowing this shortcut, so you can quickly add new files. Firstly, you need to navigate in your “Solution view” to the folder in which you want to add a file. Then, simply tap cmd+n and pick what you would like to add.

add new file

Go to line/column

Cmd + g

Sometimes it may happen that you know to which line you want to navigate. Maybe you got “Code review” feedback and that line can be changed. Instead of scrolling, press “cmd + g”, type line number and do your job!

Go back

Cmd + – (cmd + minus/hyphen)

Let’s assume you are playing around with code. You are checking what is inside the package, you go deeper, deeper and now you want to go one level back to the place where you were previously.

Debugging code

Run code

F5

Are you tired of pressing that 🕷 on a toolbar? If yes, in order to run your code, press F5

No screenshot needed 😇

Step over

Cmd + F10

When debugging, use step over to navigate to next line.

step over

Step into

F11

Let’s step one level down!

step into

Toggle breakpoint

F9

When having a cursor in a line just press F9 to put a breakpoint on this line.

toggle breakpoint

Remove all breakpoints

Shift+Cmd+F9

Simply removes all breakpoints that you put before.

remove all breakpoints

Mute all breakpoints

Cmd + Shift + Alt + F10

Instead of removing all breakpoints, you might want to mute them. It’s pretty straightforward with Rider.

mute breakpoints

Worth configuring 👨‍🏫

In order to configure those, you need to open Preferences and assign a keyboard shortcut in Keymap. If you don’t want to configure Riders shortcuts for those, you can simply press Cmd + t type what you want to do and do it from that view.

Close all windows

Depending on how you work, it might be good to configure this shortcut. It simply closes all your windows.

Close others (windows)

Similar to the one above it just closes other windows then the currently opened one.

Split window horizontally/vertically

I have 24 inches display both in my work and in my home. It’s pretty wide and sometimes I want to have two files opened next to each other. With split window I can easily achieve this, so maybe it’s worth giving it a chance.

Summary

I hope this article helped you. I would like to hear from you if you want more articles like this or do you treat it as “why is he writing about it when I can check it on my own in preferences”. If you’d like to give me some feedback please leave a comment, or write me a message. If you want to learn more about Rider shortcuts, I would highly recommend visiting JetBrains’ documentation.

[mc4wp_form id=”497″]

Leave a Reply

Your email address will not be published. Required fields are marked *