For those who develop games with Unity and who want to be more efficient at typing their code in MonoDevelop, here are some handy keyboard shortcuts that I find useful.
If there are any important shortcuts that you know that aren’t on here, please let me know in the comments.
Automatically change a variable name throughout the entire script
MacOS: Select the variable name that you want to change, then press Cmd+R, type the new name and press Enter.
Can also be done with Right mouse -> Refractor -> Rename
Windows: Use F2 or Right mouse -> Refractor -> Rename
Typing or deleting text on multiple lines with Block Selection
MacOS + Windows: Alt+select
It can be very useful to be able to edit multiple lines at once in the same way.
This is possible with the use of block selections. If you want to make a block selection, hold the Alt key (on MacOS and Windows) and click-drag the mouse cursor between the start and end points.
You can also turn a normal selection into a block selection by going to Edit -> Toggle block selection mode.
Just as with normal selections you can also copy/paste block selections and block selections can also be edited to change code on multiple lines at once. If you block select a empty area you can also use it to type the same text on multiple lines!
Quickly search for information about Unity classes and functions in the Unity API
If you want to know more about a Unity class or function you can quickly jump to the corresponding Unity API page about it by selecting the name and then pressing Cmd + ‘ on MacOS or Ctrl + Shift + ‘ on Windows.
If for some reason this doesn’t work on your machine then you can change the keybinding in the Monodevelop settings.
Got to Environment -> Keybindings and look for the ‘Unity API Reference’ command.
Finding and replacing code quickly
Just as with most other writing applications and webbrowsers etc. you can look for a specific piece of text by making a selection and then pressing Cmd+F on MacOS and Ctrl+F on Windows. You can then choose to replace your selection with something else on all places that it occurs in the entire script or choose to replace code on one or more locations manually.
The ‘finding’ function is also useful to just find all the locations that for instance a method call occurs and for quickly switching between those locations with the up and down arrows from the Find window.
If you want to search trough other files as well use Cmd+Shift+F.
Moving lines of code up or down without having to copy/paste
MacOS+Windows: Alt+Up or Down arrow
To do this select the area that needs to be moved and then use Alt + the Up or Down arrow to move it up or down.
Quickly delete lines without selecting
To do this, simply select the line that needs to be removed by clicking on it and pressing Alt+X
Move code into a new method quickly
MacOS+Windows: Select + Richt mouse + Refactor > Extract Method
Select the lines that you want to place into a new method then press the right mouse button and select Refactor > Extract Method.
Now use your up and down arrow to position the yellow line to where you want to create the new method. Press Enter to select the location and type in the name for the new method: