Wednesday, September 19, 2018

Re: What is the quickes way to delete spaces in front of each line?

On Wed, 19 Sep 2018 at 7:53am -0700, Igor Forca wrote:

P.S. I know there is ed command: 1,5s/^\s\+// but this is difficult to type quickly and requires a lot of thinking. Using some normal command and repeating j. would be much simpler to think and edit.

I probably would mark the paragraph in visual mode, then use

 :s/^ *//

which I find easy to remember and quick to type. (No need for "\s\+" which is just more to type compared to " *".)

You also could mark the paragraph and do a few left shifts via

 <.....

"<" would shift the marked paragraph to the left; each dot would repeat this. Continue pressing "." until all lines have reached column 1.

Maybe this helps.

Best,
Claus

No comments:

Post a Comment