Wednesday, September 19, 2018

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

On 2018-09-19 17:36, Claus Atzenbeck 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 " *".)

If you're looking for additional laziness, if you don't have any
flags (you don't in this case), you can drop the last "/", and if
you're *also* replacing with nothing (i.e., deleting the match), you
can drop the separator "/" too, making it just

:s/^ *

If the file has a mix of tabs & spaces, you can

:s/^\s*

-tim



--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: