Use vim to edit Python

Source: Internet
Author: User
Tags virtual environment

1.vim use

1.vim Access

Vim 1.py has file open no file New

2. Command mode

: Enter the last line mode

3. Last-line mode

: Wq Save and exit: Q Quit!

4. Insert mode ESC exits to command mode

Insert

Press I (inserted before cursor position)

Press A (insert behind cursor position)

Press O (cursor position, next line, insert)

Press I (inserted at the beginning of the cursor position)

Press A (insert at the end of the cursor position line)

Press O (the cursor position, up to another line, insert)

Move

H: Ex J: Lower K: Upper L: Rear

M: Jump to Middle row

L: Skip to last line

G: Jumps to the specified line (number of rows in front of G)

W: Move backward one word

B: Move one word forward

GG: Jumping to the beginning of a file

{: Move a piece of code upwards

}: Move a piece of code down

Ctrl+d: Turn half screen down

Ctrl+u: Half screen upward

Ctrl+f: Turn up full screen

Ctrl+b: Turn the entire screen down

Delete

X: Delete one character forward

X: Delete one character to the back

DD: Delete a whole line (DD front plus number to delete multiple lines)

D0: Delete all the contents of the bank before the cursor

DW: Delete the contents of the line after the cursor starts (including the deletion of the cursor)

Revoke

U: Step-by-step undo

Ctrl+r: Anti-revocation

Copy

YY: Copy (number of lines can be duplicated in front plus digits)

P: Paste

Replace

R: Replace the current character

R: Replaces the character following the current cursor, and the cursor moves backwards

Find

/123: Find

N: Previous

N: Next

In the last line mode:

Bulk substitution:

%s/123/456/g Replace all of the 123

1,10s/123/456/g Replace 1 to 10 rows of 123

2.vim Edit py File

Python3 1.py

F5

3.input, Print

Input inputs

Print output

A = input (' Please enter a number ') print (' The number you entered is:%s '%a)

A = input (' Please enter the first number:'= input (' Please enter the second number:'=  == a + bprint(' The result of the addition is:%s'%num)

Configuring Plug-ins Bash install.sh
Virtual Environment Workon Py3env

Use vim to edit 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.