vim - How to delete the line selected by the cursor?
某草草
某草草 2017-05-16 16:33:51
0
5
1511

Press the v key, press the shift and arrow keys, select a few lines, and then press the x key to delete.

This kind of deletion does not delete the line selected by the cursor. How to delete the line selected by the cursor in vim (not gvim)?

某草草
某草草

reply all(5)
世界只因有你

dd can delete the line where the current cursor is located. If you want to delete multiple lines, you can add the number of the line to be deleted in front of dd

迷茫

In addition to the two people above, there is also a way to delete the content after the cursor in the line, press dt$

过去多啦不再A梦

Ctrl+v选中需要删除的行,dJust a moment and it’s OK!

洪涛

Shift + v is to select by row, ctrl + v is to select by block (select by column), then x and d can be deleted, similar to cutting, you can also use p to paste back.
x alone deletes the current character, dd deletes the current line, and adding a number in front means repeating it N times.

为情所困

In normal mode, you can use the x command to delete a single character, and the d command to delete more characters: d motion.

motion is a command indicating the operating range. For the motions that appear in the following content, please refer to the table here:

Button | Definition

  1. | Position the cursor at the beginning of the line

$ | Position the cursor to the end of the line
b | Position the cursor to the beginning of the word under the cursor
e | Position the cursor to the end of the word under the cursor
w | Position the cursor to the beginning of the next word
gg | Position the cursor to the beginning of the file
G | Position the cursor to the end of the file

If you want to delete more characters, you can use the c command: c motion, which is similar to the d command. The difference is that after deletion, you enter insert mode.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!