Confirm line delete

2019-04-03 16:41发布

I have created a function to search all double lines in a file.

I use the "line-number"g/.*/d to delete the line.

However I would like to confirm if a line has to be deleted or not, like the s/..//gc command

Is it possible to delete a certain line with the global or substitute
command and confirm every action?

标签: vim line confirm
2条回答
神经病院院长
2楼-- · 2019-04-03 17:34

If I wanted to delete lines in a file and confirm each one, I would:

  • search for the first one
  • if I want to delete it, press dd
  • search for the next one with n
  • if I want to delete that, press ., else n again
查看更多
走好不送
3楼-- · 2019-04-03 17:41

Why not try a substitute command instead of the delete command?

"line-number"s/^.*$\n//c
查看更多
登录 后发表回答