r/programming • u/bodiam • Apr 29 '19
Essential IntelliJ Shortcuts
https://www.jworks.io/essential-intellij-shortcuts/1
u/DropZeHamma Apr 29 '19
In case you have as much of a hard time remembering keyboard shortcuts as I have, consider checking out the Anki deck I made just now:
2
1
u/Wyrewolwerowany Apr 30 '19
I have no idea how this could be missed, but:
Command+Option+T
I believe on Windows/Linux it's Control+Shift+T, anyhow - Surround option.
It has everything you can think of while editing and in need of surrounding selected code with something (i.e. try-catch, loops or just brackets).
1
u/bodiam May 05 '19
Not missed, but I never use it. What would you surround something with?
1
u/Wyrewolwerowany May 05 '19
First thought: try-catch structure.
Second thought: loops
Third thought: markups in HTML.2
u/bodiam May 07 '19
I mostly write Kotlin these days, so I hardly use try catch blocks. For loops I usually type 'iter<tab>', and markup in HTML, good point, but I hardly create HTML these days, so maybe that's why I don't use it. Thanks for the feedback!
1
u/abhijat0 Apr 30 '19
On Linux this is ctrl-alt-t. ctrl-shift-t is for test cases.
(although gnome overrides it to open a new terminal and I had to override the gnome keybinding).
2
u/GNUandLinuxBot Apr 30 '19
I'd just like to interject for a moment. What you're referring to as Linux, is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux. Linux is not an operating system unto itself, but rather another free component of a fully functioning GNU system made useful by the GNU corelibs, shell utilities and vital system components comprising a full OS as defined by POSIX.
Many computer users run a modified version of the GNU system every day, without realizing it. Through a peculiar turn of events, the version of GNU which is widely used today is often called "Linux", and many of its users are not aware that it is basically the GNU system, developed by the GNU Project.
There really is a Linux, and these people are using it, but it is just a part of the system they use. Linux is the kernel: the program in the system that allocates the machine's resources to the other programs that you run. The kernel is an essential part of an operating system, but useless by itself; it can only function in the context of a complete operating system. Linux is normally used in combination with the GNU operating system: the whole system is basically GNU with Linux added, or GNU/Linux. All the so-called "Linux" distributions are really distributions of GNU/Linux.
1
u/Determinant May 04 '19
My router is blocking me from visiting this site because it's not safe:
"This site can't provide a secure connection
www.jworks.io sent an invalid response. ERR_SSL_PROTOCOL_ERROR"
1
u/bodiam May 05 '19
Probably your router, I've heard this before.
1
u/Determinant May 05 '19
Yes, I have a high-end router that I configured to prevent access to unsafe sites.
So your website isn't setup correctly.
1
u/bodiam May 05 '19
https://www.ssllabs.com/ssltest/analyze.html?d=jworks.io&latest doesn't report any issues, though I did just disable TLS1.0. Does that make a difference for you? How did you configure it to prevent access (as in: what defines 'unsafe'?)
1
u/Determinant May 12 '19
I'm using an Asus RT-AC5300 with AiProtection enabled. It's blocked because www.jworks.io is detected as a malicious site due to spam.
6
u/Dgc2002 Apr 29 '19
Ctrl + Y – Remove line
I prefer Ctrl + X as it feels more ergonomic. It cuts the line instead of deleting it so it may mess with folks who use the clipboard history a lot.
For those interested in their shortcut usage statistics you can go to Help -> Productivity Guide to see a summary.
2
Apr 30 '19
[removed] — view removed comment
2
u/abhijat0 Apr 30 '19
Specifically for intellij ctrl+shift+v shows the previous contents of the buffer as well as the current one.
1
1
u/Dgc2002 Apr 30 '19
Yup, I thought this part covered it:
It cuts the line instead of deleting it so it may mess with folks who use the clipboard history a lot.
Sorry if it wasn't clear :X
1
u/punctualjohn May 06 '19
I remapped ctrl-y to shift-delete for this purpose! It is easy to reach while I am navigating with the arrow keys, just like ctrl-x.
3
u/safetytrick Apr 29 '19
I've found that the method hierarchy feature (this is new) is a better find usages than find usages. With the cursor on a method name Ctrl+Alt+H This shows usages in a tree with usages of the method that called it, recursively. You get an entire hierarchy in reverse: getFoo <- createBarFromFoo <- initializeAllFooAndAllBar
https://www.jetbrains.com/help/idea/building-call-hierarchy.html
1
u/vqrs Apr 29 '19
What is new?
The call hierarchy is a useful tool, that's for sure, but it's no replacement for find usages which is more general and also allows for configurable grouping, excluding results an other small things.
3
u/vqrs Apr 29 '19
I would add Ctrl+Shift-Space to that list (smart type completion) and add that both this and the basic completion can be invoked twice to find chained suggestions.
I also use alt-insert a lot to create toString, ctors, equals or hashCode methods.
Alt-insert is essentially "add/create" thing in the current context. On files/folders it will allow you to create files. Ctrl-alt-insert opens the same menu of in the context of the current directory, use it to quickly create new files in the same folder.
Also, escape to go back to the editor, f12 to go to the previous tool window.
1
2
u/MacMcIrish Apr 29 '19
+1 for Key Promoter X, my coworker downloaded it and found after only a week he used the UI over 200 times for a single shortcut. Really puts it in perspective.
2
u/qiwi Apr 29 '19
I have Find Action (normally Control-Shift-A) on M-x (aka Alt-X). If you don't remember some feature (keyboard shortcut let alone which of the menus it might be in) you can type its action name.
1
u/xkufix Apr 30 '19
Additionally to extract method and extract variable there's also CTRL + Alt + P to extract a parameter and CTRL + Alt + F to extract a field.
The inverse, inlining is CTRL + Alt + N.
1
u/cowinabadplace Apr 30 '19
My two faves are:
Replace Find usages with Show usages (inline bar)
Map Refactor This to something short
6
u/bodiam Apr 29 '19
I wrote a small list of intellij shorts which my colleagues and I use on a daily basis, and hopefully it might help others!