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

查看:436
本文介绍了在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天全站免登陆