Vim configuration python highlighting and indenting

Source: Internet
Author: User
Tags set background

The configuration file for Vim is/ETC/VIMRC, or the configuration file is created in the ~/directory:

Touch. VIMRC
Highlight settings in general, Vim for the recognition of the program is automatically set highlighting, if not can be added in the. VIMRC syntax on and can adjust the background of the highlight adaptation terminal, if the background is black set Background=dark this configuration only dark /light two parameters, and it does not change the color of the background, if you want to change the background highlight Normal Ctermfg=grey Ctermbg=blue is in the terminal with a blue background, if it is in the GUI highlight Normal guibg=black guifg=whitehttp://vimdoc.sourceforge.net/htmldoc/options.html# ' background '
Indentation settings you can add filetype indent plugin on to turn on automatic indentation for tab formatting set Modeline also add comments in Python file # vim:tabstop=8 Expandtab shiftwidth=4 Softtabstop=4 can also be manually formatted set tabstop=8 expandtab shiftwidth=4 softtabstop=4or:set ts=8 et sw=4 sts=4
If the above settings are not successful, set Tabstop=9set expandtabset shiftwidth=4set Softtabstop=4filetype indent on is available separately
The above configuration can be individually set for files identified as Python, create ~/.vim/ftplugin/python.vim and add entries set num Add goodness to automatically add header annotations/ETC/VIM/VIMRC must be vim, not VI function HeaderPython()   call setline( 1 , "#!/usr/bin/env python" )   call append( 1 , "#-*- coding:utf8 -*-" )   call append( 2 , "# Power by WenBin" . strftime( ‘%Y-%m-%d %T‘ , localtime()))   normal G   normal o   normal o   endf autocmd bufnewfile * .py call HeaderPython()

Vim configuration python highlighting and indenting

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.