Vim Editor Common operations

Source: Internet
Author: User

Vim mode

Edit mode (Command mode)

Input mode

Last-line mode


Conversion Mode

Edit-Input

I: Convert to input mode in front of the character that the current cursor is in

A: After the current cursor character, convert to input mode

O: Create a new line below the current cursor line and convert to input mode

I: Converted to input mode at the beginning of the line at which the cursor is currently located

A: At the end of the line where the current cursor is located, convert to input mode

O: Convert to input mode at the top of the line where the current cursor is located

S: Replace, same as used in sed command

Input--Edit

Esc

Last line (edit mode entry)

In the last line mode:. (dot) represents the current line, $ represents the last row, or $-#,+ #表示向下的 # line

Enter a colon (:)

Set NU Display line number

! Command: Enter system commands

M,nd: Delete rows from M to n rows.

Exit:

Last-line mode:

Q exit

Q! Force exit

Wq Save exit

W Save

W! Forcibly saved

X Save exit

Edit mode

ZZ Save exit

To move the cursor:

Input mode

K,J,H,L: The upper and lower left and right numbers plus the move key indicates how many characters are moved, such as 5h

G: Jumps to the beginning of the last line

GG: Jumps to the beginning of the first line

W: Jump to the beginning of the next word

E: Jumps to the ending of the current or next word

B: Jump to the beginning of the current or previous word

(The jumps of the above words also support the form of numbers plus moving keys)

^: first non-whitespace character at the beginning of a line

0:0, jump to the beginning of H (absolute beginning)

$: absolute end of line

Default mode: Enter line number directly, carriage return


Flip Screen:

CTRL+F: Flip one screen down

Ctrl+b: Turn up one screen

Ctrl+d: Flip Down half screen

Ctrl+u: Flip up half screen


Edit mode:

U: Undo the previous action, #u直接撤销最近 # operation, the system only saves the last 50 operations

Ctrl+r: Restore the last undo operation

. (point): Repeats the last action

X: Delete the single character at the cursor, #x删除光标所在处及向后共 # characters

D: Delete, cut, dd delete the current cursor line, #dd删除光标及向后共 # line (or d#, and then press ENTER), D can be automatically combined with the cursor, for example: DG DELETE cursor start to the last line of the file

YY: Copy when moving forward

P: If the entire row is deleted or copied, paste it below the line where the cursor is located, and if the deleted content is a non-full line, paste it after the character that contains the cursor

P: If the entire row is deleted or copied, paste it above the line where the cursor is located, and if the deletion is a non-full line, paste it in front of the character that contains the cursor

Y: Copy, usage and D same

C: Replace, delete first, enter in input mode, use same as D,

R: Replace single character

R: Enter replacement mode, ESC exits replacement mode

/pattern or? PATTERN: Find matching characters, n or N to find the next


Visualization mode: You can select all the characters that the cursor has crossed, and then you can edit the operation

V: Select by character

V: Select by row


This article is from the "Doove" blog, make sure to keep this source http://doove.blog.51cto.com/1100940/1755076

Vim Editor Common operations

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.