Python Development using Sublime Text 3

Source: Internet
Author: User
Tags sublime text


When I first went to the OS X platform and looked for tools to write files such as Python,javascript,markdown, I compared a lot of tools and finally chose Sublime Text 2, mainly because of its cross-platform, and the thought of going back to Windows under development. There is no need to re-adapt to other tools. Sublime Text 2 The learning curve is not as steep as vim, but it takes time to be handy. After using sublime Text 2, there is still a period of time in memory of notepad++ of various good, fantasy notpad++ tomorrow will have OS X version. After this period of time, more and more feel sublime strong, notepad++ began to fade out of memory. The beta version of Sublime text 3 has been rolled out for a long time, but there are very few documents in the document, and most of the introductions are just stuck on how to install the package control, and very little about developing related plugins. Because of this, many people are worried that their own use of plugins is not supported version 3, so it has not been upgraded, I am also one of this mentality. This period of time is free, finally decided to toss a bit.

Before you begin, see a chart on the package Contorl website and give yourself a reassurance

As you can see, the largest plug-in has been compatible with the 3 version, and there are a handful of new plugins specifically for 3 customization. So, you can safely go to the 3 version of the trial. The Python development environment support plug-in described later is unique from Sublime 3, specifically which is not decrypted here.

Of course, do not rule out some wonderful plug-in does not support the 3 version, but if so, my suggestion is to replace that plugin, update so less, must not be the most suitable.

Install the package Control

Now the sublime Text 3 installation method and version 2, just paste the code content slightly different, on the package Contorl website has the installation method. Use the shortcut keyctrl+\`or the menu option toView > Show Consoleenter console console, then paste the following code to run the carriage return.

ImportUrllib.request,Os,Hashlib;H=' 7183a2d3e96f11eeadd761d777e62404e330c659d4bb41d3bdf022e94cab3cd0 ';Pf=' Package Control.sublime-package ';Ipp=Sublime.Installed_packages_path();Urllib.Request.Install_opener(Urllib.Request.Build_opener(Urllib.Request.Proxyhandler()));By=Urllib.Request.Urlopen(''+Pf.Replace(‘ ‘,'%20 ')).Read();Dh=Hashlib.sha256(By).Hexdigest();Print ( ' Error validating download (Got %s instead of %s%  (dh< Span class= "P", hif dh != h else open (os.path. Join (ipppf " WB ' ) . Write (by)         

After the installation is complete, we will formally start configuring sublime text!

A versatile way to install plugins

byctrl+shift+penteringCommand Palette, enteringPackage Contorl: Install Packageor shorthand forip, enter the execution, enter the plug-in Search window, find the choice to the required plug-in, enter to wait to complete the installation, entertainment status in the sublime the bottom of the status bar will have text prompts.

General configuration
    • Theme

Sublime text can be installed through the plugin many themes, there must be a suitable for you. It is recommended to use the Theme-soda dark theme that has been used on sublime Text 2, the color template uses the color Scheme-tomorrow night, the combination of the two should be counted on the classic, from notepad++ to sublime Text 2 O'Clock all the basic introductory documents are recommended. You can try this by using the plugin installation method described above.

    • Configuration file Contents
// Colors
"color_scheme": "Packages/Tomorrow Color Schemes/Tomorrow-Night.tmTheme",
"theme": "Soda Dark 3.sublime-theme",
// Font
"font_size": 12.0,
"font_options": ["subpixel_antialias", "no_bold"],
"line_padding_bottom": 1,
"line_padding_top": 1,
// Editor view
"draw_white_space": "all",
"fold_buttons": false,
"highlight_line": true,
"auto_complete": false,
"show_minimap": false,
"show_full_path": true,
// Editor behavior
"scroll_past_end": false,
"highlight_modified_tabs": true,
"find_selected_text": true,
// Whitespace - no tabs, trimming, end files with \n
"tab_size": 4,
"translate_tabs_to_spaces": true,
"trim_trailing_white_space_on_save": true,
"ensure_newline_at_eof_on_save": true,
// Sidebar
// Package Control

The individual does not like the automatic slicing and wrapping function, so there is no configuration, so the PEP8 in the back of the E501 ruled out

Development environment Plug-in
    • Git

The repository is an indispensable tool in software development, which adds git's common commandsCommand Palette, making it easy for developers to manage their code.

    • Gitgutter

This small plug-in is the modified file line number before adding some logo image, easy to compare with the repository, modify the content at a glance.

    • Gist

Creating and managing gist plug-ins, gist is another powerful tool provided by GitHub, which uses git to manage the code snippets that users use often online. After you install this plugin, open its user-setting and add a personal GitHub access token that you can use with the shortcut key or console.

    • Anaconda

Anaconda is definitely changed to sublime Text 3 after the most exciting I plug-in, no one. In the sublime Text 2 era, in order to configure a good Python development environment, we need to install all autocomplete,sublimerepl,pylinter and PEP8 and many other plugins. Geek is to make everything easier, and the plugin author concentrates these functions for simplicity. Anaconda integrates Pyflakes, PEP8 and McCabe in a plug-in manner. After installing Anaconda, a good python development environment can be completed by configuration.

Anaconda is a python development suite this includes autocompletion, IDE features, linting with Pylint or Pyflakes + PEP8, AutoPEP8, Vagrant and more for Sublime Text 3.

Installation can be installed through the package control, or you can use Git to track the latest version. GitHub Address

After the installation succeeds in the plugin configuration to open the Anaconda Reamme, you can refer to the personalized configuration. I have made the following changes here:

    • Automatic hints when adding point operators to an object

Create the file in thePackages/UserdirectoryPython.sublime-settings, add the following content

    "auto_complete_triggers": [{"selector": "source.python - string - comment - constant.numeric", "characters": "."}]
    • Automatic completion of parameters after adding parentheses operator

TheAnaconda Settingvalue of the modifiedcomplete_parametersparameter in istrue. Here is another parameter, which,complete_all_parametersafter setting ittrue, will automatically complete with the default values.

    • Ignore theAutoFormat PEP8hints in E501

All other settings use default values.


Only the installation and configuration of these plug-ins, you can make Sublime text 3 an efficient Python development tool, Next, feel Sublime text 3 as fast as the wind, lightning!

Using OS X for a long time has forgotten that the vast majority of Windows users have GBK coding problems. Today, I opened some code written on Windows before I found that Chinese comments are garbled. The solution is simple, install plug-in ConvertToUTF8, OS x or Linux also requires plug-in CODECS33. In addition, the plugin GBK Encoding support on Sublime Text 2 is not supported for version 3.

    • ConvertToUTF8

Support the editing and saving of multiple encoding files such as GBK.

    • Codecs33

CJK library files missing in the embedded Python of Sublime Text 3.

Python Development using Sublime Text 3

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: 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.