VIM,运行多个文件的命令 [英] VIM, Run a command on multiple files

查看:173
本文介绍了VIM,运行多个文件的命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一堆青菜文件和我的设计师使用了错误的语法。我想:保证金顶1px的但他却的margin-top:1px的

I have a bunch of sass files and my designer used the wrong syntax. I wanted :margin-top 1px but he did margin-top: 1px

所以我很容易地写了一个子命令:

So I easily wrote a sub command:

:rubydo sub! /([\w-]+):/,':\1'

这样的作品和修复所有的冒号和我想的地方移动它们。我有一个样式表目录中约50萨斯文件。我怎样才能一次性运行所有我的文件这个命令?我真的不知道如何去这 VIM 。也许是与的grep ?我不能告诉你。

So that works and fixes all the colons and moves them in the place I want. I have about 50 sass files in a stylesheets directory. How can I run this command on all my files in one shot? I'm not really sure how to go about this in vim. Maybe something to do with grep? I couldn't tell ya.

推荐答案

请参阅本:<一href=\"http://vimdoc.sourceforge.net/htmldoc/editing.html#:argdo\">http://vimdoc.sourceforge.net/htmldoc/editing.html#:argdo

我现在学会了这个命令,但帮助是显而易见的。

I learned this command right now, but the help is clear.

去:

:args *.css
:argdo %s/\([[:alpha:]-]\+\):/:\1/ge | update

这篇关于VIM,运行多个文件的命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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