在 Vim 中删除一行之前的所有任意空格 [英] Remove all arbitary spaces before a line in Vim

查看:21
本文介绍了在 Vim 中删除一行之前的所有任意空格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个插件来解析 XML 标签.标签内的内容是缩进的,当我将解析后的字符串复制到文件中时,它会像:

I'v written a plugin where it comes to parsing a XML tag. The content inside the tag is indented and when i copy the parsed string into the file it's gettting like:

    Example line
        This is part of the parsed line
        Thats goes one
    End of line

我要的是去掉这几行前面的所有空格,最后的文字应该是

What I want is to remove all spaces in front of these lines, the final text should be

Example line
This is part of the parsed line
Thats goes one
End of line

我试过使用 = 但它没有按照我想要的方式工作.我怎样才能用最少的击键来做到这一点?

I've tried to use = but it doesn't work the way I want. How can I do that with minimal key strokes ?

推荐答案

要格式化左侧的行,我使用 :left.在整个文件中使用这种格式:

To format a line to the left I use :left. Use this format an entire file:

:%le

这篇关于在 Vim 中删除一行之前的所有任意空格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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