vim:搜索替换所有可写缓冲区 [英] vim: search replace over all writable buffers

查看:57
本文介绍了vim:搜索替换所有可写缓冲区的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以

1GvG:s/..../g

可以替换整个缓冲区

但是,假设我加载了多个 vim 缓冲区,并且我想对所有可写的缓冲区执行 :s 操作;有没有办法在 vim 中做到这一点?

However, suppose I have multiple vim buffers loaded, and I want to do a :s over all the buffers that are writable; is there a way to do this in vim?

推荐答案

由于我无法发表评论,我将重复布赖恩所说的内容并增加我的 2 美分.

Since I can't leave comments, I'll be repeating what Brian said and adding in my 2 cents.

我相信您正在寻找的命令是:

I believe the command you're looking for is:

:bufdo :%s/..../g | :w

注意:这将在进行更改后写入每个文件,因此请确保您已为此做好准备.

Note: This will write each file after the changes are made, so make sure you're ready for this.

如果启用了自动写入,您应该能够删除命令末尾的| :w".

If autowrite is on, you should be able to remove the "| :w" at the end of the command.

这篇关于vim:搜索替换所有可写缓冲区的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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