Sublime Text 3 python configuration

Source: Internet
Author: User
Tags sublime text


Sublime Text 3 python configuration


Package Control Installation Method



1. Open the console by pressing CTRL + ' or View > Show console, then paste the appropriate Python installation code;



2.Sublime Text 3 Installation code and enter:



Import Urllib.request,os; PF = ' package control.sublime-package '; IPP = Sublime.installed_packages_path (); Urllib.request.install_opener (Urllib.request.build_opener (Urllib.request.ProxyHandler ())); Open (Os.path.join (IPP, PF), ' WB '). Write (Urllib.request.urlopen (' http://sublime.wbond.net/' + pf.replace (', '%20 ')) . Read ())



3. Restart Sublime Text 3;



4. If you see the package control item in Perferences->package settings, the installation succeeds.


To install a plugin using the package control method:
    1. Press Ctrl+shift+p to bring up the command panel
    2. Enter install to bring up the Install Package option and enter, then select the plug-in you want to install in the list. :


pylinter.sublime-settings Configuration of the Pylinter plugin. I use the following configuration to let Pyhton automatically spec when saved and display icons for violations of the specification.


 
 
 1 {
 2     // Configure pylint‘s behavior
 3     "pylint_rc": "/Users/daniel/dev/pylintrc",
 4  
 5     // Show different icons for errors, warnings, etc.
 6     "use_icons": true,
 7  
 8     // Automatically run Pylinter when saving a Python document
 9     "run_on_save": true,
10  
11     // Don‘t hide pylint messages when moving the cursor
12     "message_stay": true
13 }





Sublimecodeintel Plug-in



Smart Tips plugin, this plugin smart tips feature is very powerful, can customize the content Library of hints, my Python smart tips settings


 1     "Python": {
 2         "python":"D:/Python27/python.exe",
 3         "pythonExtraPaths":
 4             [
 5                 "D:/Python27",
 6                  "D:/Python27/DLLs",
 7                  "D:/Python27/Lib",
 8                  "D:/Python27/Lib/lib-tk",
 9                  "D:/Python27/Lib/site-packages"
10             ]
11         }





Python PEP8 Autoformat Plugin






This is used to press PEP8 to automatically format the code. Can be installed in the Package manager. Shortcut keys ctrl+shift+r automatically format python code






Common configuration


 
 1 {
 2     "auto_complete": false,
 3     "caret_style": "solid",
 4     "ensure_newline_at_eof_on_save": true,
 5     "find_selected_text": true,
 6     "font_size": 11.0,
 7     "highlight_modified_tabs": true,
 8     "line_padding_bottom": 0,
 9     "line_padding_top": 0,
10     "scroll_past_end": false,
11     "show_minimap": false,
12     "tab_size": 4,
13     "translate_tabs_to_spaces": true,
14     "trim_trailing_white_space_on_save": true,
15     "wide_caret": true,
16     "word_wrap": true,
17 }









sublimerepl



1, call Ctrl+shift+p, enter: Sublimerepl Select and install, (this machine can not find this when the installationSUBLIMEREPL, then enter the install package to bring it back)
2, then tools--sublimerepl--python you will find that a Python shell window is open, obviously this is not what we want;
3, continue to go down, select a good we want to execute the PY file, select tools, Sublimerepl Python--RUN Currentfile, this time has supported the input of the data;
as shown in:


4, for debugging convenience, we can put this window to the right, first set sublime window display as multilayer:

Then call discovery:

is more convenient for debugging,
5, and finally, because each run of the program must be executed: tools Sublimerepl. RUN currentfile menu is a bit cumbersome, so now consider creating a shortcut key for him;
Method: Perferences--Key bindings user paste the following code (shortcut Key personal like F5):
[{"Keys": [" f5"],
"caption": "Sublimerepl:python-run Current File",
"command": "Run_ Existing_window_command "," args ":
{
" id ":" Repl_python_run ",
" file ":" Config/python/main.sublime-menu "
}}
]

So after you open the PY program you want to run, you can directly follow the shortcut keys you set to run;

Third, after the language
This plugin does not know why, sometimes the operation will be error, but sometimes it is good, the error is as follows:
the personal solution is to press a few ctrl+b to compile under sometimes good .... I do not know there is no fundamental solution, overall this plugin is not too easy to use ...
shortcut keys that might be useful:with a variable selected, ALT+F3 can select all variables with the same name


Sublime Text 3 python configuration


Related Article

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.