Vim Configuration python development environment

Source: Internet
Author: User

Posted on November 7, 2011 by Sam

This time has been in Python with the idle editor, but this idle code indentation really hurt, when you use the If:elif:, the Elif: not automatically aligned, which makes me often in the debugging time only to find the code indentation problems, So this time finally summon up the courage to change the idle to vim, but with vim there is a more disturbing problem, when you write a good code with VIM, you want to press F5 run to see the effect (many editors are F5 to run) under the vim of course is not possible.

Look, my requirements for the Python editor are simple.

1. Automatic indentation of code

2, code highlighting

3. Running and commissioning

Python's own idle code indentation is really a pit daddy, and Vim has no Python running debug

To make vim the Python editor we need to do some setup.

Open Vim installation directory edit _VIMRC file

1. Let vim display the line number of the code (idle does not display)
Set Nu
2. Set File encoding
Set fileencodings=tuf-8,ucd-bom,gb18030,gbk,gb2312,cp936
3, set indentation, (recommended to set 4 spaces as indentation)

Set tabstop=4

Set sts=4

Set Expandtab

Set softtabstop=4

Set shiftwidth=4

Set Autoindent

Set Cindent

Set Cinoptions={0,1s,t0,n-2,p2s, (03s,=.5s,>1s,=1s,:1s

4, modified under the font color, vim default white bottom black words really do not drop
ColorScheme Desert
5, the elimination of Vim automatic backup function (auto-generated ~ file is actually very not see)

Add a line below behave Mswin

Set Nobackup
6, I have just started to use vim to write Python code will often inadvertently press F5, so for vim configuration Python debugging is quite necessary.
Map <F5>:! D:\python32\python.exe%

After adding a map, when we have finished writing the code, press ESC and then press the F5+enter to invoke Python to run the code.

Our configuration of vim is complete and you can use VIM to complete all of the idle functions.

Original: http://www.cnblogs.com/lexus/archive/2012/03/11/2390414.html

Reference: https://www.zhihu.com/question/20271508 (Know)

Vim Configuration python development environment

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.