Pieter Op de Beeck wrote:
> Hi All,
>
>   I'm trying to delete empty lines on the condition that the previous
> line matches a certain pattern, like for example in the next input
> file:
> foo
> foo
>
> foo
>
> foo
>
> bar
>
> bar
>
>   I would like to remove an empty line if the previous line matches
> 'foo'. I came up with:
>
> :g/foo/+ s/^\s*\n//
>
>   sadly, this doesn't delete the second empty line (at least on my
> box: vim 7.1 - debian 5.0). Repeating the same command however ends up
> deleting this second empty line as well.
>   But I'm sure there is a 'right' way to do what I'm trying to achieve
> here - your insights would be greatly appreciated.
http://vim.wikia.com/wiki/VimTip72


Best regards,
Fred

-- 
========================================================================
Frédéric HARDY              Responsable technique
No parking                  Email : [email protected]
10 rue Stappaert            URL : http://www.noparking.net
59000 Lille                 Tel : +33 (0)3 20 06 51 26
France                      Fax : +33 (0)3 20 63 92 21
======================================================================== 


--~--~---------~--~----~------------~-------~--~----~
You received this message from the "vim_use" maillist.
For more information, visit http://www.vim.org/maillist.php
-~----------~----~----~----~------~----~------~--~---

Reply via email to