gpt4 book ai didi

linux - 如何在 vi 编辑器中删除选定的文本

转载 作者:IT老高 更新时间:2023-10-28 12:23:50 29 4
gpt4 key购买 nike

我正在使用 PuTTY 和 vi 编辑器。如果我用鼠标选择了 5 行,我想删除这些行,我该怎么做?

另外,如何使用键盘选择行,就像在 Windows 中按 Shift 并移动箭头以选择文本一样?我如何在 vi 中做到这一点?

最佳答案

I am using PuTTY and the vi editor. If I select five lines using my mouse and I want to delete those lines, how can I do that?

忘记鼠标。要删除 5 行,可以:

  • 到第一行输入d5d(dd删除一行,d5d删除5行)~or~
  • 键入 Shift-v 进入行选择模式,然后使用 j 向下移动光标(是的,使用 hjkl移动向左向下upright,这比使用箭头更有效)并键入 d 删除选择。

Also, how can I select the lines using my keyboard as I can in Windows where I press Shift and move the arrows to select the text? How can I do that in vi?

正如我所说,要么使用 Shift-v 进入逐行选择模式,要么使用 v 进入逐字符选择模式,或者使用 Ctrl-v 进入进入分 block 选择模式。然后用 hjkl 移动。

我建议花一些时间在 Vim Tutor 上(运行 vimtutor),以一种非常具有指导意义的方式更加熟悉 Vim。

另见

关于linux - 如何在 vi 编辑器中删除选定的文本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3114936/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com