Vim series 1-mac, VI and VIM are God-like editors, how to delete multiple lines

Source: Internet
Author: User
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

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.