I've always been a big fan of Intellij for editing most anything on the JVM. But, I've sat through and given plenty of presentations where the font was wrongly sized or code was hard to read, and the presentation suffered because of it. Throughout this post, we'll get our editor set up, with shortcuts, to effectively switch for pairing, presenting, and personal development.
The Quick Fix
Uh-oh, it's happened. We weren't able to prepare, and we suddenly need to make the font bigger or smaller. First, we check our mouse. If it's an Apple Trackpad, we should be able to use the pinch to zoom features. But what if we have a normal mouse? Open the preferences pane, navigate to
Editor -> General, and make sure `Change the font size (Zoom) with Command+Mouse Wheel is checked.
Now, we can use our mouse wheel, holding down a modifier key, and continue on.
But what about when we don't have access to a mouse wheel, or simply want to use the keyboard instead? To start, we can open up the
Find Action dialogue with
Cmd Shift A. Here, typing
Increase Font Size or
Decrease Font Size, followed by an Enter, will have the effect we want.
Doing things this way is a recipe for frustration, though, as Intellij only changes the font by a single size each time. We can bind these actions to shortcuts by using the
Find Action dialogue to open up the
Keyboard shortcuts. From here, we can bind
Increase Font Size and
Decrease Font Size to whatever we'd like. I'd recommend
Ctrl + and
Ctrl -, as neither seems to be bound to anything and they are easy to remember. I'd also encourage binding
Reset Font Size to something like
Cmd Ctrl 0 to quickly reset to your default.
We're finally set! We can now adjust the font of any buffer using our preferred method, which helps out greatly when you need to show a file or two to someone else, and things aren't the right size. But there's still a lot of energy being wasted if we need to do this for multiple files.
If you regularly present or work on screens of different sizes, the solution for increasing / decreasing per file will quickly grow old. For more efficiency, we need to use color schemes. Though the name might imply otherwise, Color Schemes in Intellij control most of the settings for your editor. To get started, we'll need to go to
Editor -> Colors & Fonts -> Font in our preferences. From here, we can duplicate our current theme, e.g. Darcula. After duplication, let's rename the theme to something descriptive, like "Darcula Pairing", and update the font size accordingly.
While we can switch between these in the preferences pane, I find it's much faster to use the
Quick Switch to Scheme action, which is by default bound to
Ctrl `. Now, we can quickly switch color schemes as necessary.
You'll notice that there's a delay between when I select
Darcula Pairing and when the font size actually changes. I've found that often, you need to use
Reset Font Size on the file you currently have open, but new files should be adjusted appropriately.
And now we have all the tools to make default themes for easy re-use! I'd strongly encourage playing around with themes from the unofficial Intellij Color Themes site, and testing out lots of configurations.