PyCharm Tips

  • Open file tabs can be moved by right clicking on a tab and selecting the tab placement option. I prefer to set the tab location to the left when I have a lot of files open.
  • When there is a colored squiggly under your text or a light-bulb tip appears on the left, use Alt+Enter to pull up the suggested fixes.
  • When debugging, you can see the values of variables in-line with the source code.
  • Use the Python console when you need to test something out quickly.
  • You can search for keywords in the settings window. For example searching for ipython shows us there is an option to use ipython in the console when available.
  • Turn on line numbers. File -> Settings -> Editor -> General -> Appearance -> Show line numbers. I also prefer to turn on show whitespace and show method separators.
  • CTRL+SHIFT-Plus and CTRL+SHIFT-Minus will expand and collapse all code blocks.
  • Do it without the shift, using only CTRL+Plus and CTRL+Minus to expand or collapse the block of code where your cursor it.
  • You can create multiple cursors by holding the ALT key and clicking. This is useful for modifying multiple lines at once. Home, end and CTRL-forward/backward will each be relative to its own line.
  • When working on large projects, the favorites panel (Alt-2) can be a huge time saver. For example if you have a really large project it helps to create a favorite list for each ticket/bug fix you are working on. Add files relevant to that issue to the favorite list named after the ticket. When you have to switch between issues or go back to one a few weeks later, those bookmarks will save lots of time. You can also add all open files to a favorite list at once.
  • On the right side there is a database panel where you can browse and manipulate your database. Perfect for doing web application development.
  • When you want to leave yourself a reminder use the tag # todo xyz. Not only will PyCharm highlight it in a special color, but you can use the TODO panel (Alt-6) to see all of the todos in the entire project at a quick glance.
  • You can change the theme by going to File -> Settings -> Appearance & Behavior -> Appearance -> Theme. I prefer the Darcula theme as it is easier on the eyes since it is not as bright.
  • You can use the project view to see all the files in your project or the structure view, to see classes with their properties and values. You can sort them as they are written in the code or alphabetically.
  • Quickly comment or unncomment an entire line by pressing CTRL-/. If multiple lines are highlighted, they will all be commented or uncommented together.
  • Shift + Delete will delete an entire line and also store it in your clipboard. You can then paste that line as if you performed a cut.
  • CTRL-Space will bring up the code completion helper. It will automatically pop-up when it is needed but if it disappears and you want to bring it up manually, use CTRL-Space.
  • You can see all the available keyboard shorcuts under File - > Settings -> Keymap. You can keybind just about every action available.
  • Run a file by right clicking on the open file name, the open text editor, using the menu option at the top, or using the keyboard shortcut which is shown in the menus.

Have some more tips? Share them in the comments!