DEV Community

Cover image for 10 most useful IDE hotkeys with GIF examples
Mirosław Farajewicz
Mirosław Farajewicz

Posted on • Edited on • Originally published at blog.fill.ly

10 most useful IDE hotkeys with GIF examples

Do you know what percentage of people do not use Ctrl+F when searching text on pages?

Me neither.

But the closest estimation done by Mozilla & TestPilot says that it ranges between 81% and 90%. The number is pretty shocking to me, but if you think a bit about it - it makes sense. Not all of us work in IT. There are many older people who don’t know that they can “search on webpage” not to mention about using a hotkey for it.

For each of you crushing serious programming challenges every day, there is certain number of uncles and aunties who uses internet mainly for checking recipe for friday’s dinner. 81%-90% sounds not so shocking after having some second thoughts.

Anyway, I’m curious how those statistics look when only IT-related people were examined.

IT loves productivity. Productivity loves hotkeys.

What is surprising many developers did not develop habit of using hotkeys. I know some really good programmers who simply struggle learning them. It’s like developing every habit - you have to put some effort at the beginning, but once you get used to it - it pays off.

For me the Aha-moment for using hotkeys was my first job in office as a developer. Guys who were sitting next to me were extremely helpful. They gave me many tips on more productive usage of my IDE. Without that help I would probably stumble upon the wall of huge and enigmatic keymap in Netbeans which was my main IDE back in the days.

It's not possible to create one universal hotkey tutorial - there are few keymaps out there - most popular are based on Eclipse and Netbeans.

I will review Netbeans’ ones. For the sake of simplicity I named the keys using Windows naming. If you are a Mac user just press CMD instead of CTRL.

Here is my list.

1. Alt + Shift + Up/Down arrows

Moving mode line

Used for moving current line of code up or down. When we have selected block of text it naturally moves the entire block.

2. Ctrl + Shift + Up/Down arrows

Copying line of code

Duplicates current line of code. In Jetbrains’ IDEs: IntelliJ or PHPStorm it only copies current line below. In Netbeans however it’s possible to copy line up - there is a slight difference in where is your cursor after using the hotkey.

3. Ctrl + J

Extend selection

In Netbeans’ keymap described as “Extend selection” which may be confusing. As you see on the GIF I don’t have anything selected at the beginning so “Extending” this selection is misleading. Selects the entire word / name.

4. Shift + Alt + O

Opening by file name

Opens “Open file by name” popup. What is interesting typing name of file using only first letters of camel-cased segments helps quickly opening files with complex name.

  1. Ctrl + Shift + 1 Navigate in directory tree

Find current file in directory tree and expand this particular tree branch. Jetbrains products add ability to automatically reflects opened file in directory tree. Personally I do not use this feature.

6. Alt + Shift + F

Formatting code

This hotkey formats current file. Or if we have active selection, formats only selected piece of code.

7. Ctrl + E

Line removal

Removes current line of code. Works also for selection.

8. Ctrl + /

Commenting line

Comment / uncomment current line of code

9. Ctrl + Alt + Left / right arrow

Selecting words segments

Selecting consecutive word / expression fragments. If it’s CamelCased name - particular fragments will be selected. If it’s entire expression then adjacent operators and arguments will be selected step by step.

10. Ctrl + R

Rename

Rename current element (method, variable, class etc). Replaces automatically all other occurences.

More hotkeys please

So that’s part one of my favourite IDE hotkeys selection. In next episode of this article I will present few shortcuts mostly related to code generation and dealing with automated tests.

I hope that by writing this article I will encourage at least one person to go more towards mouseless navigation.

If you like the form of this article follow me or visit my blog.

Sources: https://blog.mozilla.org/metrics/2011/08/25/do-90-of-people-not-use-ctrlf/

Top comments (8)

Collapse
 
noedlm profile image
Noe De La Mora

A generic not so much hot key(s) but still go unnoticed are the Home and End keys. They come in handy when you want to move horizontally through long lines of code, move all your text cursors to the end/start of the lines, etc.. Combining that with Shift will highlight the whole line, and not just in IDEs but any text field.

Also a vscode version would be nice, some of my most common ones:

  • ctrl + P: look for a file in the project
  • Alt + up/down arrow: move a line or set of lines up/down
  • ctrl + shift + F: search in the project
  • ctrl + shift + O: search functions (given you have the proper addon as well)
  • ctrl + F2: multiline edit of w/e text you have highlighted
  • alt + click: will add an additional cursor to where you click to allow multi line edits
  • ctrl + W: close the current file tab in the editor
Collapse
 
mfarajewicz profile image
Mirosław Farajewicz

Home and End keys <3
Since I've started using Mac as my 2nd workstation I felt how important those keys are.

Collapse
 
noedlm profile image
Noe De La Mora

Definitely under appreciated. The other thing I miss the most after moving to mac for my new job is the key bind to move windows from one screen to another. I think it was Alt + Windows + arrow. I've read about using third party tools on mac to do that but I've been too lazy to try them out.

Thread Thread
 
mfarajewicz profile image
Mirosław Farajewicz

Yep I'm missing it too. At first click it resizes app window to half of the screen and then it moves to first position/screen on the right/left.

Collapse
 
ozgrozer profile image
Ozgur

Sublime Text version of this would be great too.

Collapse
 
mfarajewicz profile image
Mirosław Farajewicz

Thanks for the suggestion! Atm I'm working on the second part presenting remaining 10 useful hotkeys. Then if time allows I can rework both articles to other IDE keymaps.

Collapse
 
jeffwurz profile image
Jeff Wurz

also an atom version :)

Collapse
 
geeksesi profile image
Mohammad Javad Ghasemy

just customize this bad hotkey for yourself :D