如何在 Vim 中同时编辑多个位置 [英] How to edit multiple locations simultaneously in Vim

查看:37
本文介绍了如何在 Vim 中同时编辑多个位置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在某些文本编辑器(例如 E)中,我可以选择多个位置,并且在我键入时,所有选定的位置都将替换为我正在键入的字符.

In certain text editors, like E, I can select multiple locations and, as I type, all the selected locations get replaced with the characters I am typing.

例如,如果我有:

<tag1 class=""></tag1>
<tag2><tag3 class=""></tag3></tag2>

在 E 中,我可以选择引号组内的两个位置,然后开始输入,两个位置将同时更新.在Vim中,我可以一次选择多个连接的列然后编辑它们,但我想知道有没有办法选择多个未对齐的位置.

In E I could select two locations inside sets of quotations marks then start typing and both locations would be updated simulataneously. In Vim, I can select several connected columns at once and then edit them, but I'm wondering if there is any way to select multiple locations that aren't lined up.

推荐答案

看看 SnippetsEmu.它应该做一些与您需要的非常相似的事情.

Have a look at SnippetsEmu. It should be doing something very similar to what you need.

它模拟 TextMates 片段.您应该能够重复使用具有相同标签的一个片段,并且编辑会做正确的事情,在您键入时在所有位置更新相同的标签.

It emulates TextMates snippets. You should be able to have one snippet with the same tag repeated, and editing will do the right thing, updating the same tag in all locations, as you type.

这篇关于如何在 Vim 中同时编辑多个位置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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