Pycharm shortcut keys, common settings, configuration management

Source: Internet
Author: User
Tags virtual environment virtualenv

http://blog.csdn.net/pipisorry/article/details/39909057

Pycharm Learning Skills Learning Tips

/pythoncharm/help/tip of the day:
A special variant of the Code completion feature invoked by pressing Ctrl+space twice allows the name of a NY class No matter if it is imported in the current file or not. If The class is not a imported yet, the import statement is generated automatically.
Can quickly find all places where a particular class, method or variable are used in the whole project by positioning T He caret at the symbol's name or at it usage in code and pressing ALT+SHIFT+F7 (Find Usages in the popup menu).
To navigate to the declaration of a class, method or variable used somewhere in the code, position the caret at the usage and press F12. You can also click the mouse in usages with the Ctrl key pressed to the declarations.
You can easily rename your local variables with automatic correction of all places where they is used.
To try it, place the caret at the variable you want to rename, and press Shift+f6 (Refactor | Rename). Type the new name in the popup window that appears, or select one of the suggested names, and press Enter.
...

Referencecard.pdf shortcut keys can be found in the Pycharm installation directory/opt/pycharm-3.4.1/help directory The English version of the instructions or open Pycharm > Help > Default keymap ref

PyCharm3.0 default shortcut keys (translated)

Pycharm Default Keymap

1. Editor (Editing)

Ctrl + Space Basic code completion (classes, methods, properties)
Ctrl + Alt + Space quickly import any class
Ctrl + Shift + Enter statement completion
Ctrl + P parameter information (call parameters in method)
Ctrl + Q Quick View Document

Shift + F1 External document

Ctrl + Shift + Z---Redo Redo

Ctrl + Mouse Introduction/Enter code Definition
Ctrl + F1 Displays error descriptions or warning messages
Alt + Insert to generate code automatically
Ctrl + O Re-method
Ctrl + Alt + T selected
Ctrl +/Line comment/Cancel line comment
Ctrl + Shift +/Block Comment

Ctrl + W Select the added code block
Ctrl + Shift + W back to Previous state
Ctrl + Shift +/[SELECT code block end, start
Alt + Enter Quick fix
Ctrl + Alt + L code formatting

Ctrl + Alt + O optimize import
Ctrl + Alt + I Auto Indent
Tab/shift + Tab indent, not indent forward
Ctrl+x/shift+delete clipping the current line or selected code block to the Clipboard
Ctrl+c/ctrl+insert Copy the current line or selected code block to the Clipboard
Ctrl+v/shift+insert pasting from the Clipboard
Ctrl + Shift + V paste from the nearest buffer
Ctrl + D to copy the selected range or row
Ctrl + Y Deletes the selected row
Ctrl + Shift + J Add smart Line
Ctrl + Enter Smart wire cut
Shift + Enter Another line
Ctrl + Shift + U toggle between selected areas or blocks of code
Ctrl + DELETE Delete to character end
Ctrl + Backspace Delete to character start
Ctrl + numpad+/-expand/collapse code blocks(Current position: function, comment, etc.)
Ctrl + SHIFT + numpad+/-expand/Collapse All code blocks
Ctrl + F4 Close the Running tab
2. Find/replace (search/replace)
F3 Next
Shift + F3 Previous
Ctrl + R Replacement
Ctrl + Shift + F Global Lookup
{You can find a string or something in the whole project, such as looking up a function name string to see how the function was used before}
Ctrl + Shift + R global substitution
3. Operation (Running)
Alt + Shift + F10 run mode configuration
Alt + Shift + F9 Debug mode configuration
Shift + F10 Run
Shift + F9 Debugging
Ctrl + Shift + F10 Run editor configuration
Ctrl + Alt + R run manage.py task
4. Commissioning (Debugging)
F8 Skip
F7 Enter
Shift + F8 Exit
ALT + F9 Running cursors
Alt + F8 Validation expression
Ctrl + Alt + F8 Quick Validation expression
F9 Recovery Program
Ctrl + F8 Breakpoint switch
Ctrl + Shift + F8 View breakpoints
5. Navigation (Navigation)
Ctrl + N jump to Class
Ctrl + Shift + N jump to symbol
Alt + Right/left Jump to the next, previous edit tab
F12 back to the previous tool window
ESC returns to the edit window from the tool window
Shift + ESC To hide a running, recently run window
Ctrl + Shift + F4 Close the active tab
Ctrl + G View current line numbers, character symbols
Ctrl + E Current file Popup
Ctrl+alt+left/right Back and forward
Ctrl+shift+backspace navigating to the most recently edited area
Alt + F1 Find current file or identity
Ctrl+b/ctrl+click Jump to Declaration
Ctrl + Alt + B jump to implementation
Ctrl + Shift + I view quick definitions
Ctrl + Shift + b jump to type declaration
Ctrl + U Jumps to Parent method, parent class
Alt + Up/down Jump to Previous, next method
Ctrl +/[Jump to code block end, start
Ctrl + F12 Popup file structure
Ctrl + H Type hierarchy
Ctrl + Shift + H method hierarchy
Ctrl + Alt + H Call Hierarchy
F2/shift + F2 Next, previous highlighted error
F4/ctrl + Enter edit resource, view resource
ALT + Home Display navigation bar F11 bookmark switch
Ctrl + Shift + F11 bookmark Mnemonic switch
Ctrl + #[0-9] Jump to an identified bookmark
Shift + F11 Display bookmarks
6. Search related (Usage search)
Alt + F7/ctrl + F7 file query usage
Ctrl + Shift + F7 file usage highlighting
Ctrl + Alt + F7 display usage
7. Reconstruction (refactoring)
F5 copy F6 cut
ALT + DELETE Safe Delete
Shift + F6 Rename
Ctrl + F6 Change signature
Ctrl + Alt + N Inline
Ctrl + Alt + M extraction method
Ctrl + Alt + V Extract Properties
Ctrl + Alt + F extract Fields
Ctrl + Alt + C Extract Constants
Ctrl + Alt + p extract Parameters
8. Control vcs/local History
Ctrl + K Submit Project
Ctrl + T Update project
Alt + Shift + C to see Recent changes
Alt + backquote (') VCs quick eject
9. Template (Live Templates)
Ctrl + Alt + J Current row using template
Ctrl +j Insert Template
10. Basic (General)
ALT + #[0-9] Open the appropriate tool window
Ctrl + Alt + y sync
Ctrl + Shift + F12 maximize edit switch
Alt + Shift + F add to Favorite
Alt + Shift + I check the current file according to the configuration
Ctrl + backquote (') Quick switch current plan
Ctrl + Alt + S Open Settings page
Ctrl + Shift + A Find all the actions in the editor

Ctrl + TAB to switch between windows

[pycharm 2.7 shortcut keys]

Phi Blog

pycharm Common Settings

LZ hint, pycharm in the settings can be imported and exported, File>export settings can save the current pycharm settings in the jar file, reload can be directly import Settings>jar file, There is no need to repeat the configuration.

FILE--Setting->editor

1. Set up Python auto-ingest package, first in >general > Autoimport, Python:show Popup

Shortcut keys: Alt + Enter: Automatically add packages

2. "Code AutoComplete" time delay setting

> Code Completion-Auto code completion in (MS): 0, Autopopup in (ms): 500

3. Pycharm the default is not to use CTRL + Wheel to change the font size, you can set in 〉mouse

4. Show "line number" and "White space character"

> appearance "show line Numbers", "Show Whitespaces", "Show method Separators"

5. Set the editor color and font theme

> Colors & Fonts, Scheme name, select "Monokai" "Darcula"

Description: First select "Monokai", and then "Save as" for "Monokai-pipi", because the default theme is "read-only", some font size colors can not be modified, copy one copy can be modified!

Modify Font Size

> Colors & Fonts, Font, Size, set to "14"

6. Set the Indent Character to tab tab "tab"

File--Default Settings, Code Style

"Use tab character"

Python---Tick "use tab character"

Other language codes set up similarly

7. Remove default Folding

> Code Folding-Collapse By default-all remove tick

8. Pycharm is automatically saved by default, the habit of pressing CTRL + S can be set as follows:
> synchronization, save files on frame deactivation and save files automatically if application is ID Le for. The SEC's tick is removed

> Editor Tabs-Mark modified Tabs with asterisk tick

9.>file and Code Template>python scripts

#!/usr/bin/env python
#-*-Coding:utf-8-*-
"""
__title__ = ' $Package _name '
__author__ = ' $USER '
__mtime__ = ' $DATE '
# code is far away from bugs with the god animal protecting
I love animals. They taste delicious.
┏┓┏┓
┏┛┻━━━┛┻┓
┃? ┃
┃┳┛┗┳┃
┃┻┃
┗━┓┏━┛
┃┗━━━┓
┃ God beast bless ┣┓
┃ never bug! ┏┛
┗┓┓┏━┳┓┏┛
┃┫┫┃┫┫
┗┻┛┗┻┛
"""

Python file default encoding

File encodings> IDE Encoding:utf-8; Project Encoding:utf-8;

11. Code Auto-Collation settings

Here line breaks remove √, otherwise bar, and Baz will separate in different lines, not good looking.

Phi Blog

Appearance, Settings, File--

1. Modify the IDE shortcut key scheme

> Keymap

1) Execute selection in Console:add keymap > ctrl + ENTER

The system comes with several shortcut key schemes, such as "Defaul" in the drop-down box, "Visual Studio", which is useful when looking for bugs, "NetBeans 6.5", "Default for GNOME" and so on,

Because the eclipse scheme is more popular, the individual uses more, and eventually "Eclipse" is selected.

There are a couple of common shortcuts that are not the same as eclipse, and in order to be able to modify it, you have to copy the Eclipse solution first:

(1). Code hint function, the default is "Ctrl + Space", now instead of eclipse, namely "alt+/"

Main menu, code, completion, Basic, set to "alt+/"

Main menu, code-completion, Smarttype, set to "alt+shift+/"

But "alt+/" by default is also

Main menu, code---completion, Basic---Cyclic Expand Word occupies, first delete it again (right click Delete)!

(2). Close the current document, the default is "Ctrl+f4", now instead of eclipse, namely "Ctrl+w"

Main menu, window, active Tool window, Close active Tab, set to "CTRL+F4";

Main menu, Window, Editor, and Close, set to "ctrl+w";

2. Set the IDE skin theme

> Theme, select "Alloy.idea Theme"

or search in setting theme can change the theme, all colors Unified change

File > Settings > Build.excution

Automatically execute code every time you open the Python console

> Console > Pyconsole

sys# print (' Python%s on%s '% (Sys.version, sys.platform)) sys.path.extend ([working_dir_and_python_paths])Import   osprint (' current workdirectory: ', OS.GETCWD ()  )import  as NP  Import  spimport  MPL

If Ipython is installed, use a more powerful Ipython in the Pyconsole

> Console

Check the use Ipython if available

So every time you open the Pyconsole, it will open Ipython

Note: Install Ipython in virtualenv: (ubuntu_env) Pika:/media/pika/files/mine/python_workspace/ubuntu_env$pip Install Ipython

File > Settings > Languages & Frameworks

If you turn on Django support in your project settings, turning on the Python console automatically turns on Django console, but if you don't want to, turn off the project's support for Django:

If you turn on support, you'll see a django console in Settings > Build.excution > Console:

The Django console is set up as follows

SYSprint(' Python%s on%s '% (Sys.version, sys.platform))Djangoprint(' Django%s '% Django.get_version ()) sys.path.extend ([working_dir_and_python_paths])DIR (Django): Django.setup ()Django_manage_shell; Django_manage_shell.run (Project_root)

File > Settings > Project:initial Project

Project Dependencies > LDA > Project depends on these projects > select Sim_cluster to invoke packages in Sim_cluster in LDA

[Configure Pycharm]

Phi Blog

Pycharm Configuring the Python Interpreter path

Python Project Interpreter Path

Python path for configuring Python project execution

For example, some projects are operating under the system python2.7 environment, some 3.4; some projects use the virtualenv python environment [Python Virtual Environment Configuration-project configuration in Pycharm]

In Pycharm > File > Settings > Project:pythonworkspace > Project interpreter > select corresponding Project > Project interprete Specify Python interpreter in R

Python Script Interpretation path

CTRL + SHIFT + F10/F10 When you execute a python script

Current working directory CWD is working directory in Run/debug configurations

Can be configured in edit Configurations > project or Defaults

Console execution path and current working directory

When executing in Python console

CWD for file > Settings > Build.excution > Console > Pyconsole in working directory

And in which you can configure

Phi Blog

Python package management in pycharm practical function pycharm

Items in Pycharm can contain package, directory (directory name can have spaces), etc.

A py file in a package of a directory to invoke a function in another py file, first set the directory to source root, so that the function is introduced correctly from the top of the package, otherwise the introduction of all errors:

Systemerror:parent module ' not loaded, cannot perform relative import

Note: Contents > Right-click > make directory as > source root

Purge compiled. PYc Intermediate files in Pycharm

Select your workspace > right-click > Clean python compiled files

Other

[Pycharm version control and database management]

[those useful features in Pycharm]

from:http://blog.csdn.net/pipisorry/article/details/39909057

Some settings and shortcut keys for Ref:pycharm

Pycharm shortcut keys, common settings, configuration management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.