Avatar

Bonjour, I'm Julia.

Code Editor Keyboard Shortcuts

#devtools

4 min read

If you've been following my last couple of blog posts, you'll know that I've started programming with Kotlin and Spring Boot. I've been encouraged to use the IntelliJ IDEA IDE when coding with Kotlin due to the in-built functionality that makes programming with JVM languages a lot easier, than say with VSCode. JetBrains, the company behind IntelliJ, is also the company that created the Kotlin programming language, so there's that. This is a similar reason as to why I'll likely stick to using VSCode when programming with TypeScript (since Microsoft developed both of the above).

Not gonna lie, opening the IDEA IDE for the first time was a blast in the face. It was pretty overwhelming and there's A LOT of things going on. At the time of writing this, there's an option in the settings to test out their new beta design, which simplified the UI a little (so I'd recommend that if you're moving across from VSCode like me).

That aside, the next thing I wanted to do to get my productivity back up was to set up my keyboard shortcuts. Because I'll still be using VSCode as my daily editor, I wanted to set up IDEA to use the same shortcuts, to the extent possible. Having to navigate through all the key clashes is a bit of a pain, but worth it because you've just got to do this the one time, in return for hours of increased productivity in the future. 😉

Here's the list of MacOS shortcuts I've settled on (the ones I use most often). I'll try these out for a couple of weeks and see how they feel. Note that the other thing I try to do is match relevant overlapping actions to my Obsidian keyboard shortcuts, in an attempt to reduce cognitive load and switching costs when I navigate through the main apps I use as part of my daily workflow. If you're wondering what Obsidian is, it's a notes manager (stored as markdown files) that I use as my Second Brain (where I store all my personal journals, coding logs, book summaries, technical blog posts etc).

VSCode keyboard shortcuts for MacOS (that also works for IDEA)

Main

  • Shift Shift / Cmd + P : Search for files
  • Cmd + Shift + P : Open command palette
  • Ctrl + = / - : Zoom in / out

File explorer

  • Ctrl + Shift + E : Go to file explorer (and back to editor)
  • Cmd + down arrow : Opens folders

File editor

  • Cmd + T : Focus on editor
  • Cmd + | : Split editor
  • Cmd + [ : Move between split editors

Editing code

  • Cmd + B : Go to declaration
  • Cmd + Opt + B: Go back
  • Ctrl + Shift + left/right arrow : Remove and expand text selection
  • Cmd + Opt + / : Toggle block comment
  • Cmd + Shift + | : Go to corresponding bracket
  • Cmd + up/down arrow : Go to top and bottom of file
  • Cmd + backspace: Delete entire line
  • Cmd + D : Repeats line
  • Cmd + U : Undo selection
  • Shift + Opt + up/down arrow : Move line of code up and down
  • Ctrl + G : Select next match

Terminal

  • Ctrl + ~ : Go to terminal
  • Cmd + E : Focus on editor
  • Cmd + T : New terminal window
  • Cmd + | : Split terminal
  • Cmd + Opt + left / right arrow: Toggle through a terminal group
  • Cmd + Opt + up / down arrow: Toggle through different terminal groups

Toolbar views

  • Ctrl + Shift + G : View source control
  • Ctrl + Shift + T : View testing
  • Ctrl + Shift + D : View run and debug

Github Copilot

  • Opt + ] : Show next inline suggestion
  • Opt + [ : Show previous inline suggestion
  • Opt + \ : Trigger inline suggestion
  • Ctrl + Return : Open GitHub Copilot

IntelliJ IDEA specific shortcuts for MacOS

File editor

  • Cmd + mouse scroll : Zoom in / out

Terminal

  • ESC : Focus on editor

© 2016-2024 Julia Tan · Powered by Next JS.