Getting to IntelliJ Zen

By Simone Kalmakis November 14, 2017

buddha

This past March I attended a conference called PGConf to learn more about PostgreSQL. On day two, I found myself seated next to a man silently eating his lunch. I asked him what his name was and what he did, and was delighted to find out that his name was Vitaliy and he worked for JetBrains. JetBrains makes IntelliJ, which is the software development tool that many of my fellow Flatiron engineers and I use every day to write our code. I've worked in IntelliJ at my last three companies, across three different languages (Java, Scala, and now Python). As anyone on my team will tell you, I *love* IntelliJ. It is a powerful IDE with an impressive number of intelligent, time-saving features. I consider myself somewhat of an IntelliJ evangelist, and love showing coworkers new features and encouraging them to make the switch from IDEs such as SublimeText and Vim.

Once I found out Vitaliy's employer, I immediately whipped out my laptop and asked him to teach me about his favorite under-the-radar features. He showed me how to color code databases in IntelliJ's database plug-in, DataGrip: red for Prod and green for Dev to avoid mistakes. He showed me that you can search within toolbars I wouldn't expect, like DataGrip and the Project list, by just typing with that section activated. I was thrilled. I made up my mind then and there that I would bring Vitaliy and his coworkers to Flatiron to give a demo of their favorite advanced features. The world must know!

I spent the next six months e-mailing back and forth with the JetBrains crew, trying to convince them to come talk at Flatiron. I was met with initial pushback, but was determined. Finally, the team got the green light to come visit Flatiron. As they coordinated flights and planned their trip, it was then that I realized they were not coming from the Boston office like I had thought, but from JetBrains' headquarters: Moscow!

The big day arrived in September when the JetBrains team made it to our office in NYC at last. Our engineering team gathered in our conference room modeled after a library to meet the JetBrains team. JetBrainers Max and Paul took turns taking us on a tour of advanced features and showing off what IntelliJ can do. The reaction from my coworkers ranged from rapt attention to cheers and clapping.

Max and Paul talked about getting to the "Zen" of IntelliJ. IntelliJ Zen means minimizing mouse use and maximizing screen real estate. Here are some of my favorite features that they showed us to help you get there.

Note: keyboard shortcuts referenced below are for Macs.

Navigation

Bear with me: hide all your toolbars and tool windows. Yes, it's scary! But the commands below replace the need for them. Take the leap.

    • Command + E: The all-purpose answer to everything! Gets you to tools and recent files.
    • Command + O: Open any file.
        • This was already a frequent action for me, but what I didn't know is that IntelliJ searches intelligently through the word. For example, I can get to a file called `patient_manager_steps.py` by just typing ` p m ste`.
    • Command + Ctrl + O: Search through any Symbol - variable name, method name, class name, etc.
    • Control + Tab: Switcher. Jumps you back back to the last file.
    • Shift + Command + A: Find Action. This will change your life! Use this to enter any command instead of searching for it in the UI. You can actually execute actions from here, for example toggling on/off a toolbar.

        • I now find myself using this all the time for features such as "Annotate" and "Database" to get to DataGrip.
    • Shift Shift: search everywhere, for when you are really lost :) Searches through any object, preferences, etc. - everything.
    • Command + Up: Navigate through the file structure using arrow keys.

        • Now that I know about this feature, I never have to use the Project menu anymore.
    • Command + B: Navigate between variable/method/class definitions and their usages. I use this all day every day.

Debugging


    • Enable Cython to improve debugging performance (Python-specific).
    • Watch variables or expressions in the debugger.
    • Step Into My Code: like the standard debugging feature "Step Into" but it excludes libraries.
    • Run to Cursor: use this as a one-time breakpoint.
    • Alt + F8: Switch to an interactive prompt at a breakpoint in the environment.
    • Next to the Debugger tab, can access a full console with all the context of your environment - imports, etc.

General


    • Shift + Alt + Up/Down: Move code up and down.
        • I was already a big fan of this feature, because it allows me to preserve what's in my current clipboard since you don't have to cut/paste to move code around.
  • Multiple cursors (this one is a huge time saver!)

      • Press alt twice, keeping it held the second time, and use arrows to get multiple cursors.

      • Alt + Shift + Mouse click for using the mouse to select disparate lines, or multiple locations within a single line
    • Right click on a file to get to the Local History of the file.


Feeling more Zen already? Use these tips ‘n tricks to get the very most out of IntelliJ. I guarantee you won't want to go back to your old IDE.

My many thanks to Vitaliy, Max, Paul, and their management for allowing Flatiron to enjoy learning about my favorite product right from the mouths of its makers all the way from Russia!