The basics and not so basics of Visual Studio.

Objective: shed some light on some useful shortcuts in Visual Studio for Windows.

Rose Owen
6 min readAug 31, 2021

This one is a little different from the ones I’ve been writing lately but it’s helpful nonetheless. Sadly this is only for Windows PC as I don’t have a way to test on Mac PC. You may already know some of these maybe even all of them but when I started out, I knew almost none of these and had to work them out myself. This is for those people.

Tab:

This one can be used in many ways, by itself or used with other keys.

By itself, it will cause an indent that will stop at the same point along the way.

As you can see by the last one, this goes off where the mouse pointer is.

Tab can even be used when you are coding to fill outline a lot faster.

Really helpful when you have cold hands and can’t type as fast as normal.

Tab+Shift:

This can be used to undo that indent.

If you select multiply lines and keep shift held down you get this,

This one does change a bit if the line is all the way to the left, then you will need at least 1 character to be able to move the line.

If you select multiply line but Don’t keep the shift key down, you get this.

Alt + Tab:

As you will already know, this one is a windows combo and doesn’t do anything in Visual Studio. If you didn’t know, this just changes between open windows on your desktop.

Ctrl+Tab /Ctrl+Shift+Tab:

This one works a bit like Alt+ Tab for windows but for Scripts in Visual Studio.

If you press Ctrl+ Tab then lift only Tab off, you will get a list of the scripts, tap Tab again and you will scroll through the list. As soon as you lift the Ctrl key, it will change to that script.

“Sure that’s helpful and all but I don’t want to have to go through the whole list to be able to get to a script 2 above the one I’m on.” This is where the shift key comes into play.

If you press Ctrl+Tab to bring up this menu again, this time press and hold down the Shift key, now when you press the Tab key, it will go up the list instead of down.

After opening the list of scripts, remember to keep Ctrl+Shift down and tap Tab, release Shift to be able to go down again.

Alt:

This one I have found myself using the most so far. If you are on a line or multiple lines you want to be able to move, instead of rewriting all the code or copying them and pasting to the new spot. Use Alt+ Up/Down arrow keys.

This one when moved will swap itself with lines that are in the way.

The same goes for multiple lines.

EDIT:

Remembered this one after this one was posted.

When you are typing out some code and you click off something and lose the context menu, you can bring it back up if you press Alt+ Right.

Can be handy when you select the wrong variable that has almost the same name to be able to quickly change it without having to rewrite it.

Alt+Shift:

Another use for using the Alt key is when you are selecting things and only want things past a certain point. (this one I think I’ve used the least but still helpful to know)

Instead of selecting a full line, it will only select it at a point.

Using Tab to move them to the right and Shift+Tab to move them to the left.

Alt+Ctrl:

This one you can use to go through the open scripts. It’s a little like Ctrl+Tab but able to be done with a mouse. (Actually, this might be the least used lol)

This one will work when you press Alt+Ctrl then press the Down arrow. After the menu is opened you can lift off the Alt and Ctrl and use the Up and Down arrows then select the script with the Enter key.

Ctrl:

useful in many ways, this one really depends on what you are using it with.

When you use Ctrl + Up/Down arrows you get a scrolling effect.

Which can save you from having to move your hand to the mouse to move up the code a bit.

When you use Ctrl+ Left/Right arrows you are able to jump around in code. Makes removing those empty space easy too, Ctrl + left then BackSpace, all gone!

As you can see, it jumps to the start/end of each variable/method name.

Combine the Ctrl+Left/Right arrows with Shift and you can select things pretty fast.

F2:

Here is a useful way to be able to change variables in a script.

Simple select a variable you want to be changed then press F2, retype in what you want, and press Enter.

Can be useful when you want to change variables that don’t really make sense or to fit naming conventions.

F12:

This one is helpful for finding where a script is being called from.

Click on the method name and press F12.

Can be used on any method, even Unity’s build-in ones.

Comments:

Comments can make things a lot easier to understand what is happening or if you want to remove some code for testing.

For single lines or select lines, we can use // . This will turn the code green signaling that it’s now a comment and won’t get looked at by the compiler.

For multiple lines we have 2 choices, /// and /* */ each has their places.

If you want to write out an intro for your code

or want to write out some lines of pseudo-code before implementing something.

As you can see it automatically puts the /// at the start of the next line, with // it won’t do that.

For /* */ it’s a bit different, you can see do what /// does with multiple lines as everything between /* and */ gets turned into a comment.

This one I use all the time for testing things out since you can remove large chunks of code without having to delete it or do a million //

Although my personal favorite with it is being able to use //alongside it.

Now all you need is 1 / to re-add the code to work, which makes things super easy to test or try out code to see if it works better.

These are all the ones I can think of at the moment. If you know of some that aren’t in here leave a note and I’ll add them in too, giving credit to who suggests them.

Personally, I have found a lot of these really useful and hope you do too. Back to the normal programming in the next one. See you there!

--

--