10 most useful IDE hotkeys with GIF examples [part II]
Tags: productivity, beginners, webdev, tutorial
Published: 2019-12-13 13:47:04


####This is the second part of the [article](https://blog.fill.ly/10-most-useful-ide-hotkeys/) that had a really warm welcome in [dev.to community](https://dev.to/mfarajewicz/10-most-useful-ide-hotkeys-with-gif-examples-2hkf). Some of you commented on your favorite hotkeys, some asked about version for different IDEs. First things first, I want to finish with a set of another 10 hotkeys that will make you the master of hotkeys.

During my work as a dev I use all of them every day (or almost every day).

**They are solid background for being really prolific in code refactoring.**

As I mentioned in the first part this keymap is based on Netbeans. In most of modern IDEs you can choose this one (definitely in Eclipse, Netbeans and Jetbrains Family of IDEs such as PHPStorm)

Ok, this is an article for better productivity, let’s not waste time for more theory.

## 1\. Ctrl + G - Go to Line Number

![ctrl + g gif](https://lh6.googleusercontent.com/dcM9bARtChYTTL05cnHj51wbwLrjTvBySrE8zW_CCAjbFHKrTbd4jS91iHkGdAJ_gg8BeY_cPh2mw7P_EUQbgB68pGIny4XzX_TPPgC1ztx2pEYAY9fPDHJFQ8VYluOstqWKBOaP)

This is pretty self-explanatory. What is cool about this hotkey it works in environments such as Notepad++, Chrome Dev Tools. You can also type a character number after “:” mark. 170:35 means go to 170th line and put cursor on 35th character.

## 2\. Ctrl + Tab - Show last opened files

![ctrl + tab gif](https://lh3.googleusercontent.com/SvSd91I6Idxe3CUbEwXn5CJ_snB21vd868Xc9uq93-mw3k72ru4RckQ8QrAsjOg5r1Hy6A8ohWRwoO6AoW3NIdNl0qa8vsdElhGFInkre9M-q4vfgHh1RKS5fG9_1k8C6CIqBD1D)

This particular hotkey is extremely useful. I think it goes just after the podium of Ctr+C, Ctrl+V and Ctrl+S in daily work. If you’ve never used it, here’s how it works. You press CTRL then holding it for the entire time press Tab. Every Tab stroke is moving selection to the next file from the list. Releasing Ctrl will open the selected file. After using the list is naturally reordered.

**The guy who first came with this idea in IDE should be rewarded with a Nobel-prize equivalent for UX inventions.**  

## 3\. Alt + Shift + V - Extract variable

![alt shift v gif](https://lh3.googleusercontent.com/WkV-wDZ9pM4OMw5gd0GWlmLTCy4xoemITlfLLlARZwK2VxpknVVE19rKBS6fR---zKUUup2HsachI0kDUWofxS2Xucex09m8JNrB991HGjUB5d_QtOmQw7iOLHJPFtFIZbTAQk9L)

Number 1 hotkey for refactoring. Together with the one presented as next you can un-spaghetti your code very easily. PHpStorm which I’m using detects multiple occurrences of code that should be extracted to a variable and replaces all occurrences.

## 4\. Alt + Shift + M - Extract method  

![alt shift + m gif](https://lh6.googleusercontent.com/LP881Ma9YNkKRS8VPLl7AEarW56qyOb6xN4SQuuHQ0drrBY1wqasHDDXl8P7HxvsTT6ygwji4JA08cBONsd1FbKBSHSapoYoa40k9l0McBDdC_qJbFIY6PvPr0CkA96sQ3o3yiMa)

Works extremely smart in modern IDEs - it detects parameters and return value but it also allows you to customize signature. If you have **big blocks of legacy code that are written according to God-Class antipattern** it’s the perfect moment to learn this shortcut. If there are moments you want to extract some block to separate method, but you are afraid of multiple dependencies (parameters) this hotkey will automatically detect what is needed.  

## 5\. Ctrl + Shift + H - Replace in project

![ctrl shift + h gif](https://lh6.googleusercontent.com/fijecVW0mlYaW6MygsTYORyvi9P-s4sCOGqouey7v3zZcbyEo4qz4oK-uuDj7oAm4_5C3PrjavlNO7VYoLZ94GcMhra5ikg8B5fkILWVXfL58OVH33LUW75QsQvGD6KfjD6rpl9j)

Perhaps this GIF is not an ideal example as it doesn’t show what happens after confirming changes. It was hard to squeeze usage of this hotkey into a few seconds GIF.

Basically, it’s like Ctrl + H (replace of string) but working in the scope of entire project or selected directory.  

## 6\. Ctrl + Shift + I - Optimize imports

<figure class="kg-card kg-image-card">![](https://lh5.googleusercontent.com/ZPMQD5lUIs3yacMpMZembDCuS17M9vQ85cAcTVg9DkfnwbgjYcpb353oN9atRIZSo2YEP-eou3dMILcMqbZ_tjZnx7WW1j0AXiCJ6L7unfsWApgAv3vAZKFV8CVgd3Uhw2nT2Tjl)</figure>

Self-explanatory. Removes all the unnecessary imports. As you probably guess, it works only with languages and frameworks that support imports.  

## 7\. Alt + Left/Right arrows - Jumping in code tree

<figure class="kg-card kg-image-card">![](https://lh3.googleusercontent.com/uMFjw2g3HcGioEe9x4GXIRAgj_dn0GFkbOT9GcIR8dGCLQCOEPzfI0I4tCC4ErfI_oAQeasKuRh8Nkflk2sFqo7JT180sn_Vwdlacj3NI-3qnRgx_kmL1BTjVfR4mP2fZ0RKWynv)</figure>

Great shortcut for navigating in complex code-base written with many layers of abstraction. Sometimes you click on method signature to check its code, then you go deeper and deeper. And then you want to go back two levels up. You can return using shortcut #2 or using this hotkey.  

## 8\. Ctrl + minus/plus - Collapse / Expand block of code

<figure class="kg-card kg-image-card">![](https://lh6.googleusercontent.com/T2rzDRZxQtqCbypkL2P8Dtqm1pHAU4WrRCz3P9IOK_IdlLmfbfOmHYLFCp9EKzu7p637LkLJVpISpw92EZezsB6Jv_Mx-oFPvQ7m_0ogrWNQNOAKbsTxEiwo_p4vdAb3OJwEnNJC)</figure>

Useful in God-Class files containing 5k lines of code. Also, I tend to use it for huge configuration files written in YAML, JSON or plain PHP.  

## 9\. Ctrl + Shift + T - Go to test

<figure class="kg-card kg-image-card">![](https://lh4.googleusercontent.com/Tf1e445-pxpwKFOtRitJbJfh1SuPp02OSIR--1rOBAiYQayNvv9wWXOuYAVB3z3MMUj23FvIuCj-5LZGznIeDZ3OvtFdTOYCE_C6j_zQgzpRY4OVJgY2J8rVFtdTrRwJpgIN7To1)</figure>

Goes to test file (if exists), prompts to create test file or returns to the tested class file. If you have more than one file matching pattern it will open dialog with possible options. It can be replaced with hotkey #2 (as long as you opened both class file and test file), but anyway it’s good to know it.  

## 10\. Alt + Shift + F6 - Run test

<figure class="kg-card kg-image-card">![](https://lh3.googleusercontent.com/faREOYDdBuOzBssyDDg_NijejnA8AN875uMSECOXsgzMUZ3dKTyf9XcvPGZwEoM1e8TeghgXK7HzAmZhCUNQuksPMILcDgPgOeC8Wx9NCGQhGUxEk_o2awDqFMp-v9Sw5bcQrr0y)</figure>

Runs test in the current file. If you are the lucky guy working with a codebase that is heavily covered with automated tests you can save some seconds by using this hotkey instead of clicking on a green arrow icon somewhere in the menu of your IDE.  

So that’s it. Positions 11-20 of my hand-picked set of most useful hotkeys. My proposition for you is to immediately test some of them in your IDE. The longer you keep a non-hotkey way of navigation, the harder it will be to learn this productive habit of using shortcuts.

**Go beyond CTRL + C / CTRL + V** and learn using some of the #20 starting from this very moment.

If you liked formula of this tutorial [follow me on twitter](https://twitter.com/mfarajewicz) to get notifications of other upcoming tutorials. **When it comes to hotkeys I plan to publish a series of “Refactoring patterns on GIF examples”**. It will illustrate combinations of hotkeys on real-life examples of refactoring.

Also, I think about creating “20 most popular hotkeys” with a keymap different than the Netbeans one.