Linux Bash-vim

Source: Internet
Author: User

Vim,virtual Interface Improvement is a full-screen, modal editor editor.

    • Mode

Edit mode (Command mode):

Input mode:

Last-line mode:

    • Mode conversion

Edit mode, Input mode:

I: Turns into input mode before the character of the current cursor.

A: Turns to input mode after the current cursor character.

O: Create a new row below the current cursor and switch to input mode.

I: The line at the beginning of the current cursor is converted into input mode.

A: The line at the end of the current cursor is converted into input mode.

O: Creates a new row above the line where the cursor is currently positioned and transitions to input mode.

Input mode, edit mode:

Esc

Edit mode, last-line mode:

Last-line mode, edit mode:

Esc

    • Open File

Vim/path/to/file: Open file.

Vim +n/path/to/file: Opens the file and navigates to the specified line.

Vim +/path/to/file: Opens the file and navigates to the last line of the file.

Vim +/pattern/path/to/file: Opens the file and navigates to the beginning of the line that was first matched to the pattern.

    • Close File

In the last line mode:

WQ: Save the file and exit.

Q: Exit.

q!: Do not save and exit.

W: Save the file.

W!: Forcibly saved.

X: Save the file and exit.

In edit mode:

ZZ: Save the file and exit.

    • Move cursor

Character-by-word movement:

H: Move left.

J: Move Down.

K: Move up.

L: Move right.

NUM+H: Moves num characters to the left.

NUM+J: Moves the num characters down.

Num+k: Moves num characters up.

Num+l: Moves num characters to the right.

Automatically by word:

W: Moves to the beginning of the next word.

E: Moves to the ending of the current word or the next word.

B: Move to the beginning of the current word or the previous word.

Num+w:

Num+e:

Num+b:

In-line jump:

0: Jump to the beginning of the line, absolute beginning.

^: jumps to the beginning of non-whitespace characters, not the absolute beginning.

$: Jump to end of line, absolute end of line.

Inline Jump:

Num+g: Jump directly to Num line.

G: Jump directly to the last line.

    • Flip Screen operation

CTRL+F: Flip a screen to the end of the file.

CTRL+B: Flip a screen to the file header.

Ctrl+d: Turn down half screen.

Ctrl+u: Turn up half screen.

    • Edit command

In edit mode:

x: Deletes a character at the cursor location.

Num+x: Deletes the total num characters that are at the cursor and backwards.

D: Used in combination with the jump command to delete the specified character.

Num+d+ Jump Character:

DD: Deletes the line where the cursor is located.

NUM+DD: Deletes the total num row, including the row where the current cursor is located.

P: If the entire row is deleted or copied, paste it below the line where the cursor is located, or paste it after the character of the cursor if the deleted or copied content is not a whole line.

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

Y: Used in combination with the jump command to copy the specified characters.

C: Combined with jump command, delete character and convert to input mode.

R: Replaces the specified content with the specified character and can only replace a single character.

R: Enter replacement mode .

U: Undo the previous edit operation, the continuous U command can undo the previous N operations.

Num+u: Undo Num Edit operation.

Ctrl+r: Undo the undo action just now.

.: Repeats the previous edit operation.

V: Enter visualization mode and select by character.

V: Enter visualization mode and select by rectangle.

/pattern: Match down to find.

? pattern: Match up to find.

In the last line mode:

START,ENDD: Deletes from the start line to the first end line.

.: The current row.

$: Last line.

+n: N rows down.

S: Find and replace.

Linux Bash-vim

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.