Set the sublime Text Python development environment to pave the way for a good start on the road to programming!

Source: Internet
Author: User
Tags sublime text

Recently, when I mostly used the Python development environment to edit, I began to use Sublinme Text 3 more and more, this article mainly shows that Python programmers can use more convenient settings and adjustments.

Why Choose Sublime Text?

I used to be a loyal user of textmate. This is a lightweight, open source software that is native to OS X and has a good Mac style. However, although TextMate is a great editor, sometimes it seems to be not functional enough.

I've used some of the more powerful software, such as IntelliJ idea, which adds a Python plugin. I particularly like its debugger and test runner. However, a full-featured IDE like IntelliJ is too large for small and medium-sized projects.

I've been using Sublime Text more and more in recent weeks. When I installed it, it felt very good. It's really very fast, automatic periodic updates, and even better is full support across platforms. For me, it is ultimately better than textmate where the sublime is a powerful plug-in subsystem. For Python development, there are a number of plugins that will make your development smoother and more enjoyable.

I'm still switching the editor between different projects. But I found that with Python development, Sublime has a good balance between a lightweight editor and a full-featured IDE.

Selection of fonts

Ubuntu Mono is a very, very nice font. The other day I just switched over from Menlo, which is absolutely not to be regretted.

On my 15-inch MacBook, Ubuntu Mono's number 16th is perfect. 1680x1050 resolution for a sidebar plus two editor windows (automatically adjusted to 80 characters justifies) just right.

Installing plugins

As mentioned earlier, Sublime has a very rich plug-in system. I am currently using the following plugins:

    • The package control installs the add-in Bundle manager directly in the Sublime. This is the only plugin you have to install manually. All other plugins listed here can be installed through the package Control. You can also use it to update installed plugins. Simply want to do is Sublime packages apt-get on the line.
    • Color Scheme-tomorrow night color schemes determines the font color of the editor interface Syntax highlighting. This is a very cool dark line style.
    • Theme-soda Dark Themes affects the color and style of the Sublime interface elements. This is a perfect color scheme for tomorrow night.
    • Sidebarenhancements This plugin provides additional contextual menu options for the sidebar, such as "New File", "New Floder", and so on. These should have been the default, but not.
    • All Autocomplete Sublime The default AutoComplete only focuses on the words of the current file. This plugin expands its AutoComplete word list to all open files.
    • Sublimecodeintel enhances auto-completion for some languages, including Python. This plugin also allows you to jump to the definition of the symbol, by holding down ALT and clicking on the symbol. Very convenient.
    • SUBLIMEREPL allows you to run the Python interpreter directly from the editing interface. I tend to run with Bpython in a separate terminal window, but sometimes sublimerepl is helpful.
    • Gitgutter in the Groove area of the editor, according to Git, add small icons to identify whether a row has been inserted, modified, or deleted. In Gitgutter's readme, there are instructions on how to change the color icon to update your color scheme file.
    • Pylinter This plugin provides the best pylint editor integration I've ever seen. It automatically checks the. py file whenever it is saved and displays the Pylint violation directly in the editing interface. It also has a shortcut to disable the partial pylint check by inserting a #pylint: disables the comment. This plugin is really useful for me.

Configuration file

One advantage of Sublime Text is that all of its configurations are simple JSON-based configuration files. This allows you to easily move the configuration to another system. I've seen some people use Dropbox to automatically sync the configuration on all their computers.

The preferences.sublime-settings configures the display and behavior of the Sublimede. You can open and edit this file in sublime by Preferences > Settings-user. I use the following configuration:

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.

Key Bindings

The Sublime key binding is also a fully configurable JSON-based Sublime-keymap configuration file. I modified some of the default configurations to better match my textmate/intellij muscle memory. You can not modify it at all. If you want, the modifications are simple and can be used across platforms. I use the following bindings:

Command-line tools

Similar to TextMate mate, Sublime Text contains a command-line tool that allows you to open the editor through the shell. The tool name is Sublis and is not available by default. To make it effective, run the following in either Shell:

To use Sublime as the default editor for git interactive commands-for example, to compose submissions-simply add the following line to your ~/.profile file:

More inspiration

I hope this installation guide will help you. If you have any suggestions or comments can be corrected below.

Set the sublime Text Python development environment to pave the way for a good start on the road to programming!

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.