是否有 vim 命令来选择粘贴的文本? [英] Is there a vim command to select pasted text?

查看:15
本文介绍了是否有 vim 命令来选择粘贴的文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现自己经常重复以下操作模式.

I find myself often repeating the following pattern of operations.

我通常进入视觉模式,选择一些行或块.然后我使用 y 拉取它们,并使用 pP 粘贴它们.下一步是选择粘贴的文本,替换变量或函数名称或更改缩进.

I usually go into visual mode, select some lines or block. Then I yank them using y, and paste them using p or P. The next step is to select the pasted text, to replace a variable or function name or change indentation.

我知道我可以使用 gv 来重新选择来源",但我想要的是一个类似的命令来选择目的地".

I know that I can use gvto reselect the "origin" but what I would like is a similar command to select the "destination".

:help gv 提到:
在可视模式下使用p"或P"后,放置的文本将被选中.

但它仅在您用寄存器的内容替换选择时有用,而不是在插入一个全新的块时有用.

but it is only useful when you are replacing a selection by the content of register, not when you are inserting a whole new block.

推荐答案

您正在寻找

`[v`]

'['] 是vim自动设置的标记到先前更改或猛拉的文本"的开头和结尾.v 在中间切换到可视模式.

'[ and '] are marks automatically set by vim to the start and the end of the "previously changed or yanked text". v switches to visual mode in between.

这篇关于是否有 vim 命令来选择粘贴的文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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