Wednesday, September 5, 2018

Re: How do I delete from the end of the line through space (up to) the first word?

On Wed, Sep 5, 2018 at 1:44 AM 'Grant Taylor' via vim_use
<vim_use@googlegroups.com> wrote:
> Before:
>
> """
> example.net <-- actually important
> different.example.com <-- not actually important
> """
>
> After:
> """
> example.net
> different.example.com
> """

You could do that with a substitute: to delete " <--" and all that
follows it to the end of the line anywhere in the file:

:%s/ <--.*$//

Remove the % sign to do it on the current line only, or for a Visual
block, hit : in Visual mode, you'll see :'<,'> on the command-line,
and fill it up starting at the s of the :s[ubstitute] command, to get

:'<,'>s/ <--.*$//

Best regards,
Tony.

--
--
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:

Post a Comment