Nathan Wailes - Blog - GitHub - LinkedIn - Patreon - Reddit - Stack Overflow - Twitter - YouTube
PyCharm
Related pages
- ...
Nice characteristics / features of PyCharm
- The pop-up 'tip of the day'.
- Being able to search anywhere in the options menu.
- The attractive Darcula theme.
Misc
- 2014.02.01 - Andrew Brookins - An Epic Review of PyCharm 3 from a Vim User’s Perspective
- TODO: Summarize the tips in this.
The best sequence to learn shortcuts in
- Learn "Shift-Shift" to look up the shortcut to do something.
How to do various things in PyCharm
PyCharm shortcuts I want to learn
- Open and close the left-hand pane.
General appearance / colors
- To switch between the night theme and day theme, hit Ctrl+ ` , then '5' to select the 'Look and Feel' option, and then choose either '1' for Darcula (the night theme) or '2' or '3' for either the IntelliJ day theme or a Windows day theme (respectively).
- Note that the 'Look and Feel' refers to both the IDE and the editor (the text area), while the 'Color Scheme' options you'll see are only referring to the editor (the text area). (Source)
Running files
- I rebound the shortcut to
Ctrl + b
to make it easier to reach.
Git
- Add a file to git when you've selected it in the Project sidebar: ctrl+alt+a
- View git blame: Press Shift twice (quickly), then type out 'Annotate' and select that option.
Navigation / tabs
- Switch tabs
Alt + Left
andAlt + Right
- This doesn't work in distraction-free mode.
- Hold down
Ctrl + Tab
and use the arrow keys to choose what you want to navigate to.Ctrl + Tab
by itself will switch to the last file you had open.- This does work in distraction-free mode.
- Close a tab: I'm using the custom shortcut Ctrl + w
- Switch between files
Ctrl + Shift + n
opens the "find file by name" dialog.- Or
Ctrl + Tab
Cursors
- create multiple cursors in adjacent rows: (IDK how to do this yet)
Copy
- copy row at cursor: (IDK how to do it but I've seen Cody do it.)
Modify
- Format code: ctrl+alt+l (the lowercase letter "L")
- Find and replace: ctrl+r
- Surround a selected block of code with some statement: Ctrl + Alt + T (Source)
- This is really helpful when working with HTML, as you'll often want to surround something like an <img> tag or an <a> tag with a <div> tag so that you can adjust the width and height of the element.
Side-windows / panes
- Close the bottom pane tools (Terminal, Python console):
Alt + F12
- Close all tool windows (left pane, bottom pane, right pane):
Ctrl + Alt + F12
- 2016.10.23 - I'm finding that I really like having two windows open side-by-side, where one pane is for the actual code and the other pane is for the tests.
- Right-click and select 'Split vertically'.
- Also, I'm finding that I like zooming the code out in each pane so that I can see the entire function at once.
Find
- Find misc. useful information, like the keyboard combination for a particular command: shift-shift.
- Find and replace: ctrl+r
Changes I've made to my PyCharm settings
Settings
- Editor
- General
- Smart Keys
- Enable 'Surround selection on typing quote or brace'
- Mouse
- Enabled 'Change font size (Zoom) with Ctrl+Mouse Wheel.'
- Smart Keys
- General
- Allocate more memory to PyCharm: Help→Edit Custom VM→Increase the xmx setting.
- https://blog.jetbrains.com/idea/2006/04/configuring-intellij-idea-vm-options/
- A MI: Don't make the value too big.
- You can also find this file in C:\Users\Nathan\.PyCharm2016.2\pycharm.exe.vmoptions
- https://blog.jetbrains.com/idea/2006/04/configuring-intellij-idea-vm-options/
Shortcuts
- I reassigned 'Rename' to Ctrl+Backquote, which had been set to 'Quick Scheme Switch', and I reassigned that command to Shift+F6, which had been the combo for Rename.
- Ctrl+Shift+x to 'Run'
- Alt+a to 'Select Line at Caret'
- Alt+Shift+w to 'Close Active Tab'
- Ctrl + w is set to "Close current tab"
Plugins
- Markdown support
- Create a markdown file ("test.md").
- You should see an alert saying something like "PyCharm has plugins enabling markdown support." With a button that says "Install".
- Restart PyCharm.
Misc
- If you you're getting squiggly red lines underneath your module names in your import statements (usually this happens if you have all your Python code within a subfolder), right-click the parent directory of the Python code, go "Mark Directory As" → "Sources Root". (Source)