Live data from Hacker News

My Favorite Shortcuts for JetBrains' IDEs

markusdosch.com

21–30 of 71 posts

Re: My Favorite Shortcuts for JetBrains' IDEs

#21
post #6

Ctrl-alt-L (cmd-alt-L) is my all-time favorite. It reformats the code consistently. It's the first thing I do when I start work on a new codebase, and the last thing I do before a commit. No need for endless discussions on which style is best, as the IDE allows you to set the preferences on a per-project basis. It can also read editor config dotfiles so you can use code formatting consistently throughout a team.

A potential next step if it fits your workflow is to create a macro triggered by save. I have one that optimizes imports, reformats code and do silent code cleanup.

Re: My Favorite Shortcuts for JetBrains' IDEs

#22

The JetBrains IDEs implement their own raw keyboard event handling, which means that if you have your system set up with a non-standard keyboard layout and JetBrains hasn't implemented their own support, it just won't work. The issue on their public issue tracker has been open for something like 8 years. Unfortunately for me this means that no keyboard shortcuts using the Cmd key work, despite me using a built-in mac…

> despite me using a built-in macOS keyboard layout with no special customisation.

I also use a built-in macOS keyboard layout with no special customisation, and I regularly use shortcuts with Cmd. Perhaps you might want to change your Keymap in IntelliJ(this can be done by Double Shift -> Type Keymap -> Select new value.

Edit: For me, almost all the shortcuts detailed in this post work, just need to replace Ctrl with Cmd.

Re: My Favorite Shortcuts for JetBrains' IDEs

#23

While we talk about JetBrains, I think they really should push some priority on their remote development support. Take the VS Code Remote SSH extension as a good example of how it could work, which is extremely seamlessly, and it just works. E.g. even the embedded terminal provides a shell on the remote host, and if you e.g. open a file in there via `code somefile.txt`, it will open in your VS Code. It's basically th…

i'm using remote dev right this second in pycharm. other than the terminal thing (which is solved by just having ssh open) i don't have any issues.

Re: My Favorite Shortcuts for JetBrains' IDEs

#24
The best thing about this is the consistency across languages. Whether I am writing Java,C++,Rust, Go,Javascript, the shortcuts are the same with similar behaviour as much as possible. Shift F6 refactors the variable name. Cmd Alt M refactors a method from a chunk of code. Being able to use this muscle memory across languages is fantastic.

Re: My Favorite Shortcuts for JetBrains' IDEs

#25
post #21
post #6

Ctrl-alt-L (cmd-alt-L) is my all-time favorite. It reformats the code consistently. It's the first thing I do when I start work on a new codebase, and the last thing I do before a commit. No need for endless discussions on which style is best, as the IDE allows you to set the preferences on a per-project basis. It can also read editor config dotfiles so you can use code formatting consistently throughout a team.

A potential next step if it fits your workflow is to create a macro triggered by save. I have one that optimizes imports, reformats code and do silent code cleanup.

There is already an intellij plugin called Save Actions which does this (import, reformats, and some extra stuff, like adding final to variables wherever possible(optional off course).

Re: My Favorite Shortcuts for JetBrains' IDEs

#26
post #7

Earlier quoted context omitted.

FWIW: In the 2020.1 updates that have been rolled out in the last week the SSH support is now much better. But serious question though: what workflow do you have that remote code editing is necessary?

I find remote code editing to be useful when I don't have the necessary resources on my machine such as disk/memory/gpu and I am still prototyping a solution, which happens a lot in ML/DL. I agree that remote code editing is not strictly necessary since you can perform such task with sshfs or git push/pull workflows. On the other hand, having the remote environment in your local IDE quickens the development and you d…

I also tried SSHFS, but there are hiccups. I did not really debug this. But sometimes PyCharm just freezes for 5-10 seconds. Which is extremely annoying, basically this makes it unusable. Maybe too much files are opened at the same time or so. Maybe I have to increase the cache size. I don't really know...

Also doing any Git action (git commit or so) over SSHFS is way too slow because it needs to go through the whole project directory. Maybe it's fine if the repo and project is smaller. But in this case, a Git commit can easily take a minute (while locally it takes a few milliseconds).

A Git push/pull workflow would also be quite annoying when you are prototyping and just want to try out things.

Re: My Favorite Shortcuts for JetBrains' IDEs

#27
post #21

Earlier quoted context omitted.

A potential next step if it fits your workflow is to create a macro triggered by save. I have one that optimizes imports, reformats code and do silent code cleanup.

There is already an intellij plugin called Save Actions which does this (import, reformats, and some extra stuff, like adding final to variables wherever possible(optional off course).

Oh that's nice! Thank you.

Re: My Favorite Shortcuts for JetBrains' IDEs

#29

The JetBrains IDEs implement their own raw keyboard event handling, which means that if you have your system set up with a non-standard keyboard layout and JetBrains hasn't implemented their own support, it just won't work. The issue on their public issue tracker has been open for something like 8 years. Unfortunately for me this means that no keyboard shortcuts using the Cmd key work, despite me using a built-in mac…

> despite me using a built-in macOS keyboard layout with no special customisation. I also use a built-in macOS keyboard layout with no special customisation, and I regularly use shortcuts with Cmd. Perhaps you might want to change your Keymap in IntelliJ(this can be done by Double Shift -> Type Keymap -> Select new value. Edit: For me, almost all the shortcuts detailed in this post work, just need to replace Ctrl wit…

I'm using the Dvorak Cmd-QWERTY layout in macOS. This changes the layout to QWERTY whilst the Cmd key is held so that keyboard shortcuts are mostly in the same physical place (because most are about easy hand movements rather than letter). JetBrains does not match this behaviour.

Re: My Favorite Shortcuts for JetBrains' IDEs

#30
A couple of "problems" I've had with Jetbrains' (more specifically IntelliJ IDEA's) shortcuts are:

- Not everybody uses a "standard" set of shortcuts (understandable); so whenever I need to do something on another's system, unless they're on "IntelliJ IDEA Classic" keymap, I'm clueless for a while.

- Not wanting to re-learn the "default" (shipped with) "macOS" keymap in case they change it again because of clashes with system shortcuts

- When switching to Linux (when my MBP just decides to limit all cores to 0.8GHz for thermals and I can get no work done), I have no idea what shortcuts are there. It's a hit-and-miss, hoping Cmd maps to Alt and it's the same combination. If it were possible to replicate the entirety of the Apple keymap on Linux, I'd switch to using IntelliJ IDEA on my beefier linux machine in an instant. (Oh and if there's a terminal configurable such that I can set up iTerm's shortcuts, bliss!)

- "complex" shortcuts, like Cmd-Shift-Option-N; afraid to remap it to something (moreso, figuring out what'd be the best remap option), afraid to hurt my little-finger the more I use that.

Post reply on HN