且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何删除 Vim 中的所有其他行?

更新时间:2023-12-03 17:02:10

您可以为此使用宏.执行以下操作.

You can use a macro for this. Do the following.

  • 在命令模式下启动.
  • gg 转到文件的开头.
  • qq.
  • 单击向下箭头,然后按 dd.
  • q.
  • 10000@q
  • Start in command mode.
  • Go to the beginning of the file by pressing gg.
  • Press qq.
  • Click arrow down and press dd after.
  • Press q.
  • Press 10000@q

PS:要进入命令模式,只需按几次 Escape.

PS: To go to command mode just press Escape a couple of times.