paint-brush
10 Most Useful Code Editors Hotkeysby@mfarajewicz
330 reads
330 reads

10 Most Useful Code Editors Hotkeys

by Mirosław FarajewiczDecember 11th, 2019
Read on Terminal Reader
Read this story w/o Javascript
tldt arrow

Too Long; Didn't Read

In next episode of this article I will present few shortcuts related to code generation and dealing with automated code generation. I hope this article will encourage at least one person to go more towards writing by writing this article. I named the keys using Windows naming. For the sake of simplicity just press CMD instead of CMD. In Netbeans’ keymap described as “Extend selection’ which may be confusing. In Jetbrains’ IntelliJ or. PHPStorm it only copies current line below. It’s possible to copy line up - there is a slight difference in where is your cursor after using the hotkey.

Company Mentioned

Mention Thumbnail
featured image - 10 Most Useful Code Editors Hotkeys
Mirosław Farajewicz HackerNoon profile picture

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


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


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


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


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.

5. Ctrl + Shift + 1


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


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

7. Ctrl + E


Removes current line of code. Works also for selection.

8. Ctrl + /


Comment / uncomment current line of code

9. Ctrl + Alt + Left / right arrow


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 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.

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