Linux uses Vim to play Python

Source: Internet
Author: User

The configuration file for Vim is the. vimrc file in the current user host directory by default. The following configuration is a common vim configuration for Python development.

"Highlight when moving forward

Set Cursorline

"Set the tab to a width of four spaces

Set tabstop=4

The Auto Indent

Set Autoindent

"Use spaces instead of TAB

Set Expandtab

The Define Pythonheader () function is used to automatically insert a Python file header

function Pythonheader ()

Call Setline (1, "#-*-coding:utf-8-*-")

Normal O

Normal O

Endfunc

"The Pythonheader () function is called automatically when you create a new file that ends with a py

Autocmd bufnewfile *.py Call Pythonheader ()

"Press F5 to automatically execute the current Python file

Map:!clear;p Ython%

Note: If the. vimrc file does not exist, create it.

Linux uses Vim to play Python

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.