Vim practical guide (5): editing commands (delete, modify, copy, repeat) (1)-delete

1. Delete a single character-x command

         In normal mode, pressing x will delete the character under the cursor, such as:

         

Press x at this time to delete the u character.

Similarly, a large X deletes the character before the cursor.

2. Delete multiple characters-nx command

      n stands for numbers, such as: 5x # stands for deleting the character where the cursor is and 5 characters after it at one time, 100x stands for deleting 100 characters at a time

Similarly, a large character nX will delete the n characters in front of the cursor

3. Delete a single word-dw command

      dw will delete the word starting from the current cursor (not the word where the cursor is located, dw can be understood as: delete word);

      diw will delete the word at the cursor (i: understandable as in);

      The capital W was mentioned before, see the cursor movement section for details.

4. Delete multiple words-dnw or ndw command

      n represents a number, such as: 10dw or d10w means to delete 10 words.

      The capital W was mentioned before, see the cursor movement section for details.

5. Delete the entire line-dd command

        dd means delete the line where the cursor is located, delete the entire line.

6. Delete multiple lines-ndd command

       n represents a number, such as: 10dd represents delete 10 lines

7. Delete to the end of the line-d$ command

      The d$ command means to delete all characters from the beginning of the cursor to the end of the line (the newline character will not be deleted, even if the cursor is on the line. This is different from dd)

8. Mail to the beginning of the line-d^ command

      Delete to the beginning of the line

10. Delete to the end of the file-dG command

        Delete all lines from the line where the cursor is to the end of the file

11. Delete to file header-dgg command

       Delete all lines from the line where the cursor is to the beginning of the file

 

note:

         1. Many commands in vim can be used with numbers and cursor movement commands

             

      

Guess you like

Origin blog.csdn.net/lianshaohua/article/details/108730020