Mac, vi and VIM is God-like editor, how to delete multiple lines, at the beginning, very confused.
The following is an example of editing the host file
First, in terminal, enter vim/etc/hosts and press RETURN.
Enter the default mode of VIM.
Vim has three modes of command mode, edit mode, and default mode
Press ESC to enter the command mode, you can use the exit, save the exit, do not save the command to exit. Command mode will be sorted later
Press A to enter edit mode in the Insert mode, you can input edit text.
Delete and delete multiple rows of shortcut keys to use in the default mode. In edit mode, you can press ESC to exit edit mode.
Then enter the following command
D Delete the current cursor position to the end of a line
d$ Delete the current cursor position to the end of a line
DD Deletes the current row
5DD Delete 5 lines from the current line to the following
DL deletes the current position to the last line on the screen
DH deletes the current position to the first line on the screen
DG deletes the current position to the end of the work buffer
D1G Delete the current position to the start of the work buffer
Vim series 1-mac, VI and VIM are God-like editors, how to delete multiple lines