Today let's try to optimize your daily project work! I present you a racing series, this time not of a computer game, but of keyboard shortcuts.As a novice programmer, I was amazed at my older colleagues who could spend several hours providing solutions without taking their hands off the keyboard. However, the break between clicking was only time for conceptual work, not wasting energy on searching with the mouse for the correct file, class, method or appropriate action on the interface of our IDE.What makes some people move through code faster than others? Keyboard shortcuts!If you are still using the project tree and mouse to work, then the following reading is for you.Have a good race !
An everyday activity in a programmer's work is finding. As an example, let's try to add something to the method we created earlier:
What if we can do it like this:
A comparison of the two approaches is perfectly represented by the gif below.
In the further part of this article I will present, in my opinion, the most important keyboard shortcuts. However, I have to mention, that in most of the IDEs available on the market we can easily find the whole keymap ready to print, which I encourage you to do.
Help -> Keymap Reference
Help -> Keyboard Shortcuts Reference
Want to find a method quickly? Use this shortcut:
Ctrl + Alt + Shift + N (⌥ + ⌘ + O on macOS)
Ctrl + T (⌘ + T on macOS)
And then type the name of the method. After just a few characters, you will see a list of methods, along with information about which files they came from.
You know the name of a file but don't know where it is? No problem, just use the combination:
Ctrl + Shift + N (⇧ + ⌘ + O)
Ctrl + P (⌘ + P on macOS)
In the list, choose the file you are interested in.
If you came to code after a code review, you will certainly want to go back to the line that was discussed to make changes. You do this by going to the specific file (for example, using the method above) and pressing:
Ctrl + G (⌘ + L)
Ctrl + G (⌃ + G on macOS)
And by entering the line we need.
Do you remember the class names in your code well? Use the shortcuts below to easily navigate through them:
Ctrl + N (⌘ + O on macOS)
Doesn't have one :(
And choose the class you want.
With these four methods you can, at a small cost, significantly speed up your work with the project. An experienced programmer is not only able to optimize his code, but it’s also able to optimize work, so that the most valuable time can be spent on creative coding :)Article written by Hubert