Solve the problem of using vim to write Python's indentation incorrectly in Linux

Source: Internet
Author: User

The first step:
Open terminal, enter on terminal, vim ~/.vimrc return.

Step Two:
Input:

set helplang=cn  "Chinese help document (if the Chinese package is down) syntax Enablesyntax on" Automatic syntax highlighting set number Show line number ColorScheme Desert "Set color scheme set guifont=consolas:h12:cansi "English font set guifontwide=simsun-extb:h12:cgb2312set tabstop=4" means tab represents  4 spaces width set expandtab" means tab is automatically converted to space set autoindent "means auto indent after line break set autoread  "automatically re-read the set history=400 when the file is modified externally" the number of historical operations that Vim remembers , the default is 20set nocompatible Use Vim's own keyboard mode instead of the VI-compatible mode set confirm "when handling unsaved or read-only files, give a hint set smartindent  "smart Align set shiftwidth=4           

Then save the exit.

One drawback to this is that with the Vim editor, the tab will be converted into 4 spaces, regardless of the program you write.
so , if you just want to have these features in writing Python, or C or C + +,
In the second step, replace the
autocmd FileType python set tabstop=4 | set expandtab | set autoindent
In this case, the tab space is used only when writing a python file.

Reprint: http://blog.csdn.net/qq_32306905/article/details/51327463

Solve the problem of using vim to write Python's indentation incorrectly in Linux

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.