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