Hidden features of PyCharm

Question:

I know PyCharm is young IDE but id like to know if you guys have found some candy while using it. I know from experience that JetBrains IDE’s are filled with candy and can’t wait to find it all.

Please list your tips, perhaps something you did not first expected to be there.

Asked By: Janusz Skonieczny

||

Answers:

Control-clicking a view method in a URLconf will open views.py and bring you right to that method. Similarly, control-clicking template names in a view, and in other templates (like in the extends tag) will bring you to that template.

Not hidden, but when editing a CSS file, it shows the colors in the gutter for any styles that use color. I love that. Also for CSS: code insight offers optimizations of tags, as well as graying out unused tags.

When editing an HTML file, moving the mouse towards the top-right of the editor will display icons for several browsers…clicking those will open the current HTML in the respective browser. Not as useful if you’re using Django templates, but another piece of IDE-candy nonetheless.

Auto-import is also probably one of my favorite features. It still needs a bit of work, though. This is just a preview release, so I’m sure it’ll continuously get better.

Well done, JetBrains!

Answered By: Dan Breen

As the lead developer of PyCharm, I can tell you that we don’t usually hide features in random places, and there are a few reliable ways to discover most of them.

  • Try Ctrl-clicking on everything (methods, functions, template tag names and parameters, etc.)
  • If Ctrl-clicking works, usually so does completion (CtrlSpace), rename (ShiftF6) and Find Usages (AltF7)
  • Look through the menus and try out the actions that seem interesting
  • Look at Settings | Inspections to configure the warnings which can be highlighted by PyCharm, and note that many of the inspections have quickfixes to correct the problems automatically
  • Read the blog and try out the features highlighted there.
Answered By: yole

I don’t know if this is a hidden feature really but when you know about it makes testing so much easier.

If you run your tests through PyCharm you can click on the names and lines of the backtrace to take you to the exact line in your python code. Makes testing so much easier.

Answered By: Joelbitar

I like ctrl-w, the select block function. I’ve never ran across this before I think it’s great to be able to select a function/if block by just pressing ctrl-w a couple of times.

Answered By: Erik Johansson

Something I recently had to figure out was how to pass hardcoded arguments to a Python program when running it. I wanted to do it in the IDE rather than having to switch back and forth to a command window to run the program.

In PyCharm 1.5.2, you can click on Run, then Edit Configurations. The third textbox from the top, labeled Script parameters, allows you to hardcode program parameters. These will be used each time the program is run from PyCharm.

Answered By: Grant Palin

This isn’t PyCharm specific, I actually discovered it in IntelliJ but I though the PyCharm users should benefit too…

Try Alt+Click (Ctrl+Alt+Click if using Gnome default keymap) and drag to select text. It will select bounded blocks instead of complete lines using word wrap. These selected blocks can be used to type repetitive text or delete many parts of a line at once. Try it, you will find uses for it more often than you think!

Answered By: Jesse Webb

I have recently discovered an option (I think it’s off by default):

Surround selection on typing quote or brace

Basically if you can quickly make a string from anything, just press Ctrl-W to select and then type quote. Awesome 🙂

PS: To enable this use settings search function, search for: surround

Answered By: Janusz Skonieczny
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.