> I got one silly question: I want to delete all lines matching pattern
> completely, but I :%s/.*{PATTERN}.*// delete only text till the end of
> line.
> Using :s/^$// after doesnt't work also.
> Is where a simple way to do such substitution?
Usually, one uses the :g or :v command for that, e.g.
to delete all lines matching foobar
:g/foobar/d _
and to delete all lines NOT matching foobar
:v/foobar/d _
But of course you can achieve the same using a :s command. In your case
you only forgot to include the "\n" in your pattern, so Vim leaves it
in, which means you still have an empty line, but including it in your
:s command should also work:
:%s/foobar\n//
deletes all lines ending in foobar.
regards,
Christian
--
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
No comments:
Post a Comment