banner ad

Using PyCharm to Python Development for Mac

| February 21, 2013 | 0 Comments
0 Flares 0 Flares ×

As a Python Developer, who uses Mac as the primary development environment.

Python comes pre installed with your Mac. It is highly recommended to update your python to a newer version.  You can find newer version of python here. http://www.python.org/download/releases/. For more usage instruction, see here.

Mac also comes installed with IDLE, a python IDE. But the best python ide in my opinion is Pycharm ( From the Jetbrains Team). 

One of the added advantage of python in Mac is, it could be used for scripting Mac applications.(in place of Apple Script).

Working in an IDE actually means living in it, and it is quite natural to make your haunted place pleasant for your eyes and comfortable for your fingers. That’s why PyCharm makes it possible to choose the look and feel of the IDE and the editor, configure your preferred set of keyboard shortcuts (keymap), fine-tune scrolling behavior, highlighting, and more.

All these settings are (again) configured in the Settings dialog: click settings, and see the list of pages under the IDE Settings heading.

PyCharm is a keyboard-centric IDE. Most of the actions (navigation, refactoring, debugging, etc.) can be carried out without using a mouse, which lets dramatically increase coding speed. If you had used another IDE for a while and have memorized your favorite keyboard shortcuts, you can use them all in PyCharm.

pycharm_python

PyCharm completely suits your shortcut habits by supporting customizable keymaps. A keymap is a set of keyboard and mouse shortcuts that invoke different actions – menu commands, editor operations, etc. PyCharm comes with a set of pre-configured keymaps.

Mac PyCharm keyboard shortcuts
------------------------------
--Fred 10/4/2012

Note:  This is based on the "Mac OS X 10.5+ keymap".  The default Mac
       keymap is similar, but different.  The Windows keymaps is similar
       but different.  Also:  Mac Cmd = Windows Ctrl, Mac Opt = Wndows Alt

Keyboard shortcuts I use most often (other than standard Windows/Mac keys)
--------------------------------------------------------------------------

Cmd-Shift-A             Find PyCharm menu items, actions, preferences, etc.

Drag tabs               Tear-off tabs to see side-by-side editor windows

Cmd-W                   Close editor tab
Cmd-Q                   Quit

Cmd-Click               Goto declaration of current variable
Cmd-Down                Goto declaration of current variable
Cmd-B                   Goto declaration of current variable
Ctrl-Shift-B            Goto declaration of type of current variable
Cmd-F12                 Goto method (with checkbox for inherited methods too)
Cmd-U                   Goto superclass
Cmd-O                   Goto class (with checkbox for library classes too)
Cmd-Shift-O             Goto file
Cmd-Opt-O               Goto symbol (class, method, variable, etc.

Ctrl-Tab                Switch to another open editor/tool (easiest way to 
                        toggle between 2 edit panes)
Cmd-Opt-Left            Go back to where you were
Cmd-Opt-Right           Go forward to where you were
Cmd-Shift-[             Move left one editor tab/window
Cmd-Shift-]             Move right one editor tab/window
DblClick editor tab     Maximize/restore editor window
Cmd-Shift-F12           Maximize/restore editor window

Ctrl-Up/Down            Goto previous/next method
Cmd-Opt-[               Goto and highlight start of block (if, for, etc.)
Cmd-Opt-]               Goto and highlight end of block (if, for, etc.)
Cmd-L                   Goto line number

Cmd-Plus                Expand code block
Cmd-Minus               Collapse code block

Cmd-Shift-Backspace     Goto most recent edit of any file
Cmd-E                   List of recently viewed files
Cmd-Shift-E             List of recently edited files
Opt-Shift-C             List of recent edit actions on all files (can revert)

F2                      Goto next error
Shift-F2                Goto previous error
Hover                   Show details of current error
Cmd-F1                  Show details of current error

F3                      Toggle bookmark
Cmd-F3                  Show bookmarks (and go to them, delete them, etc)
Opt-F3                  Toggle bookmark (and specify a letter or number id)

Cmd-MouseOver           Brief info about class, method, template name, etc
Opt-Space               Quick description
Ctrl-J                  Quick doc (Up arrow button to see external docs)
F1                      Quick doc (Up arrow button to see external docs)
Shift-F1                External doc
Cmd-P                   Show param info (within method call args)
Ctrl-H                  Class Tree (Inheritance)
Cmd-Shift-H             Method Tree (Inheritance)
Ctrl-Opt-H              Method Call Tree (buttons for caller or callee tree)

Ctrl-Space              Code completion
Ctrl-Shift-Space        Smart code completion
Ctrl-Opt-Space          Class name completion (adding import if missing)
Cmd-Shift-Enter         Statement completion
Opt-Enter               Display intention actions (like clicking on lightbulb)
Ctrl-Enter              Generate code (choose action from a popup)
Cmd-N                   Generate code (choose action from a popup)

Cmd-Opt-T               Surround code with statement (if, for, try, etc.)
Cmd-J                   Insert Live Template
Cmd-Opt-J               Surround code with Live Template

Cmd-/                   Comment/uncomment
Tab                     Indent
Shift-Tab               Undent
Cmd-Shift-U             Toggle case

Cmd-C                   Copy
Cmd-V                   Paste
Cmd-Shift-V             Paste from older paste buffers
Cmd-X                   Cut

Drag                    Select text
Opt-Drag                Rectangular select text
Cmd-Shift-8             Toggle rectangular mode for select/cut/paste/copy 

Cmd-F                   Find text
Cmd-G                   Find next
Cmd-Shift-G             Find previous
Cmd-R                   Replace text
Cmd-Shift-F             Find text in files
Cmd-Opt-Down            Find next in files
Cmd-Opt-Up              Find previous in files
Cmd-Shift-R             Replace text in files

Cmd-Opt-F7              Show usages of variable in all files (popup)
Opt-F7                  Find usages of variable (in Find pane)
Cmd-F7                  Find usages of variable in file 
Cmd-Shift-F7            Highlight usages in file
Cmd-G                   Goto to next highlighted usage in file
Cmd-Shift-G             Goto to previous highlighted usage in file

Shift-F6                Rename   

Cmd-0                   Event Log window
Cmd-1                   Project window
Cmd-2                   Favorites window
Cmd-3                   Find window
Cmd-4                   Database window
Cmd-5                   Debug window
Cmd-6                   TODO window
Cmd-7                   Structure window

Ctrl-R                  Run app
Opt-R                   Run manage.py task

Ctrl-D                  Debug app
F7                      Step into
F8                      Step over
Shift-F8                Step out
Cmd-Opt-R               Resume
Cmd-F8                  Toggle breakpoint (or click in left margin)
Cmd-Shift-F8            View/manage breakpoints
Cmd-Opt-F8              Evaluate selected expression
Opt-F8                  Evaluate expression (in a popup window)
Cmd-F2                  Stop debugging

Useful menu actions
-------------------
- Window | Editor Tabs | Split Horizontally
- VCS | Local History | Show History

Settings/Modes
--------------
- Project | Gear icon in header:
  - Autoscroll from source
  - Autoscroll to source
  - Show members (saves a lot of Cmd-F12 presses)
  - Sort by type
- Structure | Gear icon in header:
  - Autoscroll from source
- Preferences
  - IDE
    - Editor | Appearance
      - Show method separators
      - Show right margin
      - Show line numbers
  - Project
    - Code Style | General | Right margin = 80 (was 120)

Complete Shortcut Key Lists
---------------------------
http://www.jetbrains.com/pycharm/docs/PyCharm_ReferenceCard_Mac.pdf
http://www.jetbrains.com/pycharm/docs/PyCharm_ReferenceCard.pdf
Download PDF
0 Flares Twitter 0 Facebook 0 Google+ 0 Pin It Share 0 LinkedIn 0 Reddit 0 StumbleUpon 0 0 Flares ×

Tags: , ,

Category: PyCharm

About the Author ()

My name is John Link.I am 26 years old. My major is Computer science and technology. I am a junior programmer with Python.

Leave a Reply

Your email address will not be published. Required fields are marked *

0 Flares Twitter 0 Facebook 0 Google+ 0 Pin It Share 0 LinkedIn 0 Reddit 0 StumbleUpon 0 0 Flares ×