Vim Common operation

Source: Internet
Author: User
Tags one more line

Vim is a very useful text editor for Linux, and people who develop under Linux are familiar with VIM commands.

1. Open on line 143th

Vim +143 filename.txt

2. Read-only mode open

Vim-r/tmp/a.txt

3. Force Save

Command mode wq!

4. Go to the end of the current line and the beginning

Command mode jump to end of line by big a
Press 0 to jump to the beginning of the line

5. How many rows to locate

Command mode: Set Nu    then: N        N is the number of rows you want to position

6. Copy multiple lines to another line

Command mode: 16,30 copy      (copy 16 rows to 30 rows to 35 rows)

7. Move the line

Command mode:          Move (38 rows to 50 rows)

8. Jump file Header and end

GG jump file in command mode first line in command mode G  jump file End

9. Clear the contents of the file

In command mode, first execute  GG here is jump to the first line of the file and then execute: DG This clears the entire file! or quit Vim  

10. Undo the previous modification

When you modify a file. For example, add some content if you want to undo press ESC to exit edit mode when you press small u to undo the previous action

11. Open the file directly to the end of the file

Vim + filename

12. Delete a line part of the content

Command mode large C deletes the character of the cursor and its subsequent row of all content

13. Delete the Forward

DD deletes the current line and saves the deleted row to the Clipboard

14. Copy and paste

The command pattern   yy copies the current line and then continues to change the contents of the row by pressing P to one more line below the line

15. Copy all lines above the cursor

Y1G or Ygg

16. Flip Screen

Command mode ctrl+f: Scroll down one screen ctrl+b: up one screen ctrl+e: scrolling down a line ctrl+y: Scroll up a row

Vim Common operation

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.