Vim:在可视模式下选择文本块的更快方法 [英] Vim: faster way to select blocks of text in visual mode

查看:27
本文介绍了Vim:在可视模式下选择文本块的更快方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用 vim 有一段时间了,我知道在可视模式下选择文本块就像 SHIFT+V 和向上移动箭头键一样简单或逐行向下,直到到达我想要选择的文本块的末尾.

I have been using vim for quite some time and am aware that selecting blocks of text in visual mode is as simple as SHIFT+V and moving the arrow key up or down line-by-line until I reach the end of the block of text that I want selected.

我的问题是 - 在视觉模式下是否有更快的方法来选择文本块,例如通过 SHIFT+V 然后指定我在其中的行号想要停止选择?(例如,通过 :35,其中 35 是我要选择的行号 - 这显然行不通,所以我的问题是要找出是否可以完成类似的操作...)

My question is - is there a faster way in visual mode to select a block of text for example by SHIFT+V followed by specifying the line number in which I want the selection to stop? (via :35 for example, where 35 is the line number I want to select up to - this obviously does not work so my question is to find how if something similar to this can be done...)

推荐答案

除了其他人所说的,您还可以使用模式搜索来扩展您的选择.

In addition to what others have said, you can also expand your selection using pattern searches.

例如,v/foo 将从您的当前位置到foo"的下一个实例.如果您真的想扩展到foo"的next 实例,例如,在第 35 行,只需按 n 将选择扩展到下一个实例,依此类推.

For example, v/foo will select from your current position to the next instance of "foo." If you actually wanted to expand to the next instance of "foo," on line 35, for example, just press n to expand selection to the next instance, and so on.

我不经常这样做,但我知道有些人广泛使用标记来进行视觉选择.例如,如果我在第 5 行并且我想选择到第 35 行,我可能会按 ma 将标记 a 放在第 5 行,然后 :35 移动到第 35 行.Shift + v 进入线状视觉模式,最后`a选择返回标记a.

I don't often do it, but I know that some people use marks extensively to make visual selections. For example, if I'm on line 5 and I want to select to line 35, I might press ma to place mark a on line 5, then :35 to move to line 35. Shift + v to enter linewise visual mode, and finally `a to select back to mark a.

这篇关于Vim:在可视模式下选择文本块的更快方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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