When I started working at a new company and working in Django, I was using PyCharm for the first time, and had a workflow established in a different IDE. Reestablishing muscle memory around different hotkeys is definitely a challenge, and I find that I often only get around to looking things up in a fit of frustration/inefficiency. So in an effort to possibly help you avoid some of that, or just to show you a fun new shortcut you didn’t even know you should look up, here are just a few of my favorites (by no means an exhaustive list)! (These assume you’re working on a mac).
First, a legend:
- ⌘: command
- ⌥: option
- ⇧: shift
- ⌃: control
⌘-⌥-o: enter symbol
This one is cool, and I tend to find that other people (my sample size is small — making up only my own team, but still) aren’t aware of it. I’m frequently looking for a given method, but can’t remember if it’s in
utils.py or directly in
views.py or…well. If you know what your method is called, you can use this hotkey to find it! It can also be used on constant definitions.
⌘-⇧-o: Open file
This one is just what it sounds like — it allows you to search for a file by name/path without having to find it in the project directory. It’s worth noting that you don’t need to type the complete file names or paths for PyCharm to find you what you’re looking for.
For example, if you have a file that can be found at
app_name/migrations/0006_..., you will be able to navigate to it by typing
app/mig/0006. I’m a fan of saving keystrokes (and let’s be real, decreasing the odds that I’ll accidentally spell “organization” as “organziation”. I do this multiple times a day, and we don’t need to talk about it).
⌘-o: Open class
This one also does exactly what it sounds like it does — you can go directly to a model or other class definition anywhere in your codebase
Note: All 3 of the above hotkeys, by default, only look for symbols/files/classes within your own codebase. If you want to include symbols/files/classes that are defined within your libraries, pressing the same keys twice in quick succession will enable this (so you don’t have to check the nifty checkbox)