GDTips#1: Efficient Coding

Ray of Ideas
10 min readFeb 14, 2021

Hello, there!
My name’s Raynhard. I’m a game developer.
Welcome to Game Dev. Tips #1 🎉

I’ll share with you some basic tips and tricks on how to utilize every feature and shortcut that may help to become faster in coding, typing, and operating in the virtual world.

If you are a veteran programmer, then my best bet is you have already known most of it, but I think you might miss some tricks that I’m about to giveaway. Well, just skim the whole article, and let’s see if you can find some tips that are worth reading. 😉

Without further ado, here are my secret recipes:

__

Reading duration: 10 minutes (250 wpm)
Last updated: Jan 17, 2021
Video version:

__

Table of Contents:

1. Basic Principles
a. Main keys
b. Hands positions
c. Combining commands

2. Navigation
a. ArrowKeys
b. Ctrl+ArrowKeys
c. End/Home
d. Tab
e. Alt+Tab
f. Ctrl+Tab
g. Ctrl+W
h. Ctrl+T
i. MiddleClick, Mouse move
j. Esc

3. Selection
a. DoubleClick
b. TripleClick
c. Shift+ArrowKeys
d. Shift+Ctrl+ArrowKeys
e. Shift+End/Home
f. Ctrl+A

4. Text Editor: Shortcuts (Visual Studio)
a. Ctrl+Shift+S
b. F2
c. Ctrl+X
d. Ctrl+Click
e. Ctrl+Alt
f. Shift+Alt
g. Ctrl+K, C
h. Ctrl+M, M

5. Text Editor: Features (Visual Studio)
a. Pin tab
b. Bookmark
c. Split screen
d. Task list
e. Snippets
f. Intentional error

6. Recommendation and Others
a. Ctrl+X
b. Delete key
c. Shift+Enter
d. WindowsKey+V

__

1. Basic Principles

First of all, these tips are mainly for WIndows users, but of course there are the equivalents of them in any major operating system. Most of the keys and terms will probably be exclusive to Windows, so bear with me. 🐻‍

1. a. Main Keys

Now, If you want to train your fingertips to dance on the keyboard, you’re going to need to understand these primary keys with its related connotation:

Ctrl: common command, single selection
Shift: antagonistic command, range selection
Alt: windows related command, external tool, typing unicode
WindowsKey: windows related command

What do you mean by antagonistic command? It means a command that acts in an opposite way from its counterpart. For example, some desktop apps exchange Ctrl+Y (Redo command) with Ctrl+Shift+Z. The exchange is logical since, Ctrl+Z is Undo, and the opposite of Undo is Redo which suppose to be Ctrl+ Shift+Z. The same thing applies for Move to Next Tab command which is Ctrl+Tab. The antagonist of it (Move to Previous Tab) is Ctrl+Shift+Tab.

1. b. Hands Positions

There are only two possible hands positions when you’re operating a computer, those are: Keyboard Only and Keyboard+Mouse. One study shows that switching between those postures may cause a loss of time by around 13%. So, be sure to stay in a specific position and reduce the need to switch positions.

Keyboard Only position is mostly used when you’re typing or coding. Keyboard+Mouse position is often used when you’re editing your work. No matter what position you’re in, your left hand should always be on top of the left side of the keyboard where Shift and Ctrl are located. Your left-hand will be the one who is responsible to smash main keys whenever you need to launch a command.

1.c. Combining Commands

Some commands that I’ll be sharing are basic commands, meaning it can be combined with another key to produce a new command. Or, combining one command with another command might probably eliminate your need to use the mouse for that specific case.

So, remember to experiment with shortcut keys you know with another key, and find your magic!

__

2. Navigation

a. ArrowKeys
➥ To move your caret (cursor) in Keyboard Only position
➥ Use case: You need to move your caret to three lines below.
➥ Alternative: Move your hand to the mouse, move the mouse, target your mouse pointer to the wanted line, click
➥ Why use ArrowKeys: faster than changing position to Keyboard+Mouse, more precise

b. Ctrl+ArrowKeys
➥ To move your caret by word length
➥ Use case: You have typed “My name James Johnson.”, you forgot to type in “is”, and your cursor is located at the end of the sentence
➥ Alternative: Move your hand to the mouse, move the mouse, target your mouse pointer to the wanted location, click
➥ Why use Ctrl+ArrowKeys: faster than changing position to Keyboard+Mouse

c. End/Home
➥ To move your caret to the start of the line (Home) or to the end of the line (End)
➥ Use case: You need to type “;” but your caret in five characters away from the end of the line
➥ Alternative: count how many characters left until the end of the line, then tap RightArrow five times
➥ Why use End/Home: a bit faster than the alternative

d. Tab
➥ To move the input selection to the next input controller (i.e. button, text box, etc.)
➥ Use case: You’re filling a form. After typing your name, you are now going to type your e-mail address on the next text box
➥ Alternative: grab your mouse, hover to the e-mail text box, click
➥ Why use Tab: faster
➥ Counter: Shift+Tab

e. Alt+Tab
➥ To move to the next active window
➥ Use case: You’re opening Mozilla Firefox, but now you need to move Chrome
➥ Alternative: grab your mouse, move it to the taskbar, click Chrome
➥ Why use Alt+Tab: well, I think you got the point

f. Ctrl+Tab
➥ To move to the next tab (in browser or in some apps)
➥ Use case: You’re opening Minds.com, now you want to switch to Parler.com
➥ Alternative: grab your mouse, move it to the tab list, click Parler.com

g. Ctrl+W
➥ To close current tab
➥ Use case: You’re done reading this article, and you want to read the article located on the next tab
➥ Alternative: grab your mouse, move it to that unbelieavably tine the “x” buttom, click it

h. Ctrl+T
➥ To create a new tab
➥ Use case: You want to open a new tab when your hands are on the keyboard
➥ Alternative: grudgingly use your mouse to click that mini “+” button

i. MiddleClick, Move the mouse
➥ To scroll a page
➥ Use case: You want to get to the bottom of this article
➥ Alternative: use your useless mouse, find that scrollbar, than click and drag it to the bottom of the page, OR, tap BottomArrow continously

j. Esc
➥ To exit a pop-up or input controller; commonly used in game
➥ Use case: You’re playing a game. You want to close the inventory panel
➥ Alternative: use mouse

__

3. Selection

a. DoubleClick
➥ To select the entire word when in Keyboard+Mouse position
➥ Use case: You typed “Hello there, World!”. You want to delete “there”
➥ Alternative: Aim your mouse pointer to the start of “there”, and then click-drag to select the entire word.

b. TripleClick
➥ To select the entire line when in Keyboard+Mouse position
➥ Use case: You want to delete an entire line from your essay.
➥ Alternative: Aim your mouse at the start of the line, then move your mouse to the end of the line, hold Shift, click, then delete

c. Shift+ArrowKeys
➥ To select some characters when in KeyboardOnly position
➥ Use case: You typed a long sentence. The sentence takes two lines. You want to delete the second half of the sentence, but your caret is at the end of the line.
➥ Alternative: Aim your mouse at desired word, click and drag to select before deleting

d. Shift+Ctrl+ArrowKeys
➥ To select words
➥ Use case: You typed “My name is James Johcncson”. There’s a typo. Your caret is at the end of “Johnsson”
➥ Alternative: tap LeftArrow several times, delete the extra “c” in “Johcncson”

e. Shift+End/Home
➥ To select the entire line when in KeyboardOnly position
➥ Use case: You want to delete an entire line from your essay.
➥ Alternative: Aim your mouse at the start of the line, then move your mouse to the end of the line, hold Shift, click, then delete

f. Ctrl+A
➥ To select everything
➥ Use case: You want to delete everything you typed
➥ Alternative: Scroll up to the start of the page/document, click at the first character, scroll down to the end of the page, hold shift, click the very last character

__

4. Text Editor: Shortcuts (Visual Studio)

a. Ctrl+Shift+S
➥ To save everything (every unsaved files)
➥ Alternative: Move your mouse pointer to File, then find Save All

b. F2
➥ To rename (refactor) a variable
➥ Alternative: reluctantly find every place where the variable is used, and then type the new variable name manually

c. Ctrl+C
➥ To copy an entire line regardless of where the caret is
➥ Alternative: move your right-hand around 15 cm to the right, grab the mouse, click and drag to select the entire line

d. Ctrl+X
➥ To cut an entire line; To delete an entire line
➥ Alternative: well… use your mouse

e. Ctrl+Click
➥ To jump to the definition of a variable.
➥ Use case: You want to change the value of a variable, but you declared the variable at the top of the file.
➥ Alternative: use Ctrl+F, then find the declaration line of that variable

f. Ctrl+Alt+Click
➥ Multi-caret feature. This allows you to type in different places at the same time
➥ Use case: You mistyped a person’s name in a string :

string dialogue = "Hello, my name is James Jon. Jon is my family name. Jon means good in France.";

➥ Alternative: Select the entire section where you want to change “Jon” to “John”, Ctrl+F, replace “Jon” with “John”. *Be sure to select the section, or you might end up replacing every “Jon” character with “John” for the entire file.

➥ Another use case: you want to add another zeros at the end of these variables:

int a = 12; 
int b = 144;
int c = 11;
int d = 1;

g. Shift+Alt
➥ Multi-caret for one straight line, or make a rectangle selection
➥ Use case: no idea

h. Ctrl+K, C
➥ To turn an entire line to comment (adding “//” at the start of the line)
➥ I recommend you to change the shortcut to Ctrl+/ if possible, or Ctrl+\

i. Ctrl+M+M
➥ To close current outlining (hide the content of a bracket)
➥ Alternative: using mouse, click the “+” button on the left side to close the bracket/section

__

5. Text Editor: Features (Visual Studio)

a. Pin tab
➥ To lock a tab to prevent it to be pushed out (hidden)
➥ Use case: In your project, you have a few files you want to edit. For the entire day, you are constantly changing one main file, called Main.cs (let’s say a singleton).
➥ Alternative: open back the file if it becomes hidden
🔗 Link to documentation

b. Bookmark
➥ To mark a line so you can jump into it fast
➥ Use case: Your file consists of thousands of lines. There is this one main function somewhere on the middle of the file, but you’re currently on the bottom of the file.
➥ Alternative: Use Ctrl+F, or use manually scroll the file until you find it
🔗 Link to documentation

c. Split Screen
➥ To view different parts of your file simultaneously.
➥ Use case: You’re debugging your program, and starting to think that the bug might be inside one of two functions that are located far apart
➥ Alternative: scrolling back and forth while debugging
🔗 Link to documentation

d. Task list
➥ To add a note inside your code. Commonly used as a todo list, or any list
➥ Use case: You hardcoded some parts of your code for testing purpose. You forgot where that hardcoded parts are.
➥ Alternative: add a comment beside the hardcoded parts, then use Ctrl+F to rediscover them
🔗 Link to documentation

e. Snippets
➥ To quickly add codes with a shortcut.
➥ Use case: Every time you’re debugging, you write “Debug.Log(“Test Success”);” manually
➥ Alternative: typing those code manually
🔗 Link to documentation

f. Intentional error
➥ To jump to the error line
➥ Use case: You file consists of thousands of lines. Currently you’re architecturing a new method, but you want to check another method somewhere on top of the file, and quickly get back to work.
➥ Alternative: scroll back and forth

__

6. Recommendation and Others

a. Ctrl+X
➥ To cut a text, or to delete a text using your left hand
➥ I highly recommend you to switch from using Backspace key to Ctrl+X, since this key doesn’t only help you delete the text, but also saves it in case you want to paste it back in. It is also easily accessed by your left-hand
➥ Alternative: Stretch your lazy hand to that Backspace key that happens to be on the right hemisphere of your keyboard

b. Delete key
➥ To delete a character in front
➥ Alternative: Hit that RightArrow key, then punch your Backspace key

c. Shift+Enter
➥ To enter a new line when Enter key doesn’t let you (not common)

d. WindowsKey+V
➥ To open clipboard that saves every text you copied previously
➥ Use case: You want to copy some texts that are located in different locations to Notepad
➥ Combine this with Ctrl+A, Ctrl+C to save all your writing in case something crashes

__

I believe you won’t use all of them, but it’s great to know many alternatives to solve a common task.

I’ll be updating the list, if I find something worth added.

That would be it. Thank you for reading!
If you like contents like this, please spare a cent by clicking the Tip$ butto non this post, or click any button that helps the post. 😁

This is Game Dev. Tips #1: Efficient Coding
By RayOfIdeas

Originally published at minds.com.

--

--