Useful IntelliJ Idea Shortcuts (For OSX)

2022-10-14
IntelliJ Idea
IDE
productivity
keyboard shortcuts

WIP

This page is updated now and then when I find new useful shortcuts

What Shortcuts

I've started using the IntelliJ Idea several years ago when a colleague of mine strongly suggested it'd be way more effective way of writing code, especially for a strongly typed languages. And it definitely was (well, at least comparing to the Emacs I've mostly used before). I've been using it ever since, and it's definitely worthy the annual subscription.

One thing that makes IDEs powerful is the keyboard shortcuts, and there's usually a plenty - and Idea is no exception. I've been using some of them from day one, created or modified a few but then thought that I'm probably not using (and don't even know about) some other useful built-in shortcuts.

So I went through some articles about the subject and gathered me a list of shortcuts I should start using, for they are handy. Posting the list here mostly for my own reference (it's easier to manage than a piece of paper the list is currently on).

The shortcuts here are for OSX only, although I believe it's not hard to map them to PC keyboard. Also there's no order to them.

The List (in no specific order)

  • ⌘⇧V History of copy-paste buffer. I have similar thing in OSX (thx Albert), but it's useful to have something specific to IDE to see specific code-related items.
  • ⌥⇧M String manipulation plugin - not a standard thing (meaning it must be installed separately as an add-on), but it's worth having for the functionality it provides.
  • FnF7 Usage of the current thing in code; same as ⌘+click, but easier to navigate to explore multiple entries.
  • ⌘B Jump to the declaration of the current thing.
  • ⌘E Recently visited files (you can also type to filter).
  • ⌘⇧E Recently visited locations (specific places in code).
  • ⌃T "Refactor this" context menu.
  • ⌃⇧J Join multiple lines - useful to concatenate strings or make code a one-liner.
  • Enter Context help actions.
  • Backspace Remove current line (also ⌘+X without selection cuts the entire line to buffer).
  • Fn F12 Class/file structure roster.
  • FnF2 Jump to the next problem in the code.
  • FnF6 Rename current thing (with propagation to all usage cases).
  • ⌘D Duplicate current line.
  • ⌃⇧↑ or ⌃⇧↓ Move to the previous/next block start.
  • ⌥⇧↑ or ⌥⇧↓ Move current line up/down.
  • ⌥↑ or ⌥↓ Select increasingly larger/smaller block of code.
  • ⌘[ or ⌘] Jump to previous/next visited place.
  • ⌥⌘[ or ⌥⌘] Jump to next/previous matching parenthesis/bracket.
  • ⌘⇧O Search for files in project (type random parts of file name and it'll find it!).
  • ⌘⇧F Search for text in project.
  • ⌘⇧C Copy the current file path. It's not necessarily useful as it copies the path from root, which is not always desirable.
  • ⌘⌥⇧C So there's also "Copy Reference" which copies a relative path to file plus line number. Which is nice, but also not quite the thing.
  • ⌘+ / - Expand (+) or collapse (-) current code block. ⌘⌥+ / - does the same for the whole current file.
  • ⌘ b Jump to the current entity declaration (same as ⌘-click). ⌥⌘ b jumps to implementation.
  • So there are more shortcuts that could be configured: "Path from repository root" and - most impressive - "Github Repository URL", which copies a link with a line reference. These need to be configured manually in Settings -> Keymap:
    Path copy keyboard shortcuts.