---
# System prepended metadata

title: PyCharm - tips & tricks

---

# PyCharm - tips & tricks

We are human, we are different, we are curious. Although not everyone agrees software developers are regular humans, we can all agree that devs are obsessed with being efficient not only in their professional life but also beyond.

I am using JetBrains products since 2010, and they served me well in my career. In this post, I want to share my favorite shortcuts I use to boost my productivity. Will briefly point them out one by one ordered by my personal preferences.

## Go back where you last edited

* Action: `Last edit location`

There are [discussions](https://www.quora.com/It-is-true-that-developers-spend-most-of-their-time-reading-code-than-writing-code) about how much time a developer actually spend time writing vs reading code. I personally can tell from my experience, that around 30% of the time I write code while spending the rest on navigating around, read code, read manuals, figuring out where things should end up to keep consistency and make life easier for other devs and future me.

We all know how to navigate through a bunch of files and scroll files to read the codebase. Now imagine there is a big project with 2000+ files. You start to write your first service class method, then pause, look around and read unit tests, observe patterns from other places, reply to a Slack message, and after about 2 minutes, you are kind of lost. What exactly am I doing here? Where did I start from?

Wouldn't be cool to have a quick shortcut to go back to where you last edited?

This is by far my favorite shortcut, that helps me get back on track fast because I change context/projects many times a day.

![](https://i.imgur.com/aQHAY2w.png)

Note that, you can [search for all available](https://www.jetbrains.com/pycharm/guide/tips/find-action/) `actions`. I'd just point out the name of the `action` for you to search. 

## Navigation

* Actions: `Navigate Back` and `Navigate Forward`

We are all browsing the web. Imagine life without back buttons :) Hard to imagine, right? I find back/forward shortcuts especially useful when I navigate through different layers like models, view, serializers then back to models, then to services. At some point, I have the "aha moment". And want to go back to validate that moment, exactly in the reverse order of screens I saw before having the "aha moment".

Also, there are other useful navigation shortcuts. I especially use `Go to Class` and `Go to File`. However, if you want to search **everything** just hit `Shift + Shift` (double Shift key). It will search through classes, method names, files, actions, etc.

![](https://i.imgur.com/Dmv5kUO.png)

## Rename class, file, and variable names

* Action: `Rename...`

PyCharm is indexing the world. Wait whaaat? Yeah, I was speaking about your Python projects. Isn't that your world? Good. Since I kind of "suffer" a bit of OCD, I constantly ask myself if a class or method name is really expressing their true *intend*. I am very careful to write *clean code*. And guess what - I abuse the renaming feature, that not only helps me to rename something in the current file but renames it **everywhere**. Even within strings, comments, import statements, and many other places.

![](https://i.imgur.com/NgWz4Eg.png)

I suggest you are especially careful when renaming a rather generic name, PyCharm magic can go wrong. E.g. renaming things also in your migration files (that you almost never want to). Hit that `Preview` to see exactly what is going to be renamed.

![](https://i.imgur.com/rw8xZ43.png)

## Refactor - Move things around

* Action: `Refactor Move`

Did you ever want to move a bunch of classes with or without inheritors to different locations? It is so annoying to do it manually and figure out which imports you need to cut and paste. I'd use this action instead.

![](https://i.imgur.com/TASuZCG.png)

## Extract methods and variables

* Actions: `Extract Variable` and `Extract Method`

Keep your methods as short as possible, but of course, while experimenting with things and you hack your way to make something work you are careless about how big and ugly is your method. Now that you have a proof of concept let's be professionals and take a few moments to clean it up. Use meaningful variable names and extract logic blocks within different methods.

![](https://i.imgur.com/uaPiJUp.gif)


## Recent files

* Action: `Recent Files`

Again comparing it to a web browser feature, the navigation history is especially useful when you remember you saw a website, but don't remember its name. I usually use this when I know I recently opened a file that I need now, but don't remember the full name.

![](https://i.imgur.com/4P5NfKd.gif)

## Others worth mentioning

* Action: `Extend selection`

![](https://i.imgur.com/cOgItp3.gif)

* Actions: `Clone Caret Above` and `Clone Caret Below`

![](https://i.imgur.com/RncsRGw.gif)

* Action: `Replace...`

![](https://i.imgur.com/6mwtMuq.gif)

## Conclusion

There are endless possibilities. Check out the PyCharm Settings. Go nuts and even edit your favorite shortcuts to stay on top of your skills, impress your fellow devs with your ability to move fast, without ever using your slow mouse to get the job done.

![](https://i.imgur.com/DERQjiV.png)

What are your favorites? 

What other powerful IDEs are you using? Let's start a debate on this. 

Thanks for reading.