Remove all arbitary spaces before a line in Vim

Fatih Arslan picture Fatih Arslan · Jan 7, 2011 · Viewed 51.8k times · Source

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 ?

Answer

Peter Rincker picture Peter Rincker · Jan 7, 2011

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

:%le