Tuesday, September 4, 2018

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

On 2018-09-04 16:27, Gary Johnson wrote:
> ^f D
>
> Any other solution that tries to find the first space by working
> backwards from the end of the line is going to require more typing,
> unless you create a macro for it.

If "^f D" (or "+f D") works, then one can do

:s/ .*

to delete the first one and then use "&" on each subsequent line to
delete if they need to be done manually. Or you can do it for the
whole file

:%s/ .*

Or just lines matching a pattern

:g/example.com/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: