Vim 选择多行的结尾(块模式,但结尾列有所不同) [英] Vim select the ends of multiple lines (block mode, but where the ending column varies)

查看:52
本文介绍了Vim 选择多行的结尾(块模式,但结尾列有所不同)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在vim中有什么方法可以选择所有这些行的结尾吗?(我只显示了这些屏幕截图中的行尾).

Is there any way in vim that I can select the end of all these lines? (I'm only showing the end of the lines in these screenshots).

在块模式下,如果底线比其余线长,我可以得到它们,但如果底线较短,则较长的线会被截断.

In block mode I can get them all if the bottom line is longer than the rest, but if the bottom line is shorter, the longer lines are truncated.

编辑 |我想我可以在选择之前用空格填充底线,然后删除空格.

EDIT | I guess I can just pad out the bottom line with spaces before I select, then delete the spaces later.

推荐答案

  1. 将光标放在要成为块一部分的左上角字符上.
  2. 使用 ctrl+v
  3. 进入块选择模式
  4. 使用 $ 选择到行尾(这是您缺少的步骤;如果您使用 移动到第一行的末尾$ 然后选择将扩展到后续行的末尾)
  5. 使用 3j
  6. 向下移动 3 行
  1. Put your cursor on the top-left character you want to be part of the block.
  2. Enter block selection mode with ctrl+v
  3. Select to the end of the line with $ (this is the step you're missing; if you move to the end of the first line using $ then the selection will extend to the end of subsequent lines as well)
  4. Move down 3 lines with 3j

Vim 文档中关于可视模式的部分有更多信息,您可以在线阅读,或者在 Vim 中输入 :help v_$.

There's more information in the Vim documentation's section on visual mode which you can read online, or just type :help v_$ in Vim.

这篇关于Vim 选择多行的结尾(块模式,但结尾列有所不同)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆