Linux vim command and linuxvim command

Source: Internet
Author: User

Linux vim command and linuxvim command
Introduction

The vim commands and vi operations are basically the same. The vim commands have many parameters. Here I list some parameters that are usually used, vim has two main interfaces: the esc operation interface and the input I editing interface.

 

 

Move cursor

0 (0): move the cursor to the starting position of the row.

$: Move the cursor to the end of the row.

H: move the cursor to the beginning of the first line of the current window (not the full text.

M: move the cursor to the starting position of the center row of the current window.

L: move the cursor to the beginning of the last row of the current window.

Gg: move the cursor to the beginning of the document.

G: move the cursor to the end of the document.

<Number> G: move the cursor to the starting point of the specified number line, which is counted from the beginning of the document.

<Number>-: move the cursor to the upper numeric row of the current cursor.

<Number> +: move the cursor to the number row under the current cursor.

 

Delete and restore

DELETE command:

X (lower case): Delete the character at which the cursor is located.

Dd: Delete the row where the cursor is located.

D: delete all characters starting from where the cursor is located until the end of the row.

<Number> dd: deletes the number row specified from the cursor's current row.

Restore (Undo) command:

U: Restore the deleted text.

U: Restore all changes in the row where the cursor is located in this edit.

Copy and paste

Yy: copy the row where the cursor is located

<Number> yy: copy the row that specifies a number from the cursor

P: paste the copied content to the next row of the row where the cursor is located.

Search for characters

/<String>: searches for the first matching string from where the cursor is located.

? <String>: search for the first matching string from where the cursor is located.

N: Find the next

N: Find the previous one.

 

 

Save and exit

: Q: Exit vi.

: Q! : Discard the current modification to the edited content and forcibly exit vi.

: W [<File Name>]: Save the content being edited as <File Name> (equivalent to Save ...), if <File Name> is not specified, use the original file name (equivalent to Save ...).

: Wq: The storage disk exits.

 

Summary

The vim command is the most commonly used command in linux. The preceding operations are performed on the esc operation interface.

 

 

Note:

Author: pursuer. chen

Blog: http://www.cnblogs.com/chenmh

All essays on this site are original. You are welcome to repost them. However, you must indicate the source of the article and clearly give the link at the beginning of the article.

Welcome to discussion

 

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.