On 22:46 Sun 28 Jul , Sven Guckes wrote: > * Ajabu Tex <ajabu...@gmail.com> [2013-07-28 22:30]: > > In an HTML file I want to solve the following task: > > for every and all the lines that end with '-<br/>' (without quotes) > > I want to delete the string '-<br/>' and > > join the line with the following one. > > :g:-<br/>$:s:-<br/>$::|normal gJ > > the :global command basically tags all lines > matching a pattern - and then the command after > is (:substitute) is executed for each tagged line. > the pipe separates from the next command which > ":join"s the current line with the next one. > however, the "join" command converts an EOL > into a space. the "gJ" command simply > joins without this conversion, but > as it is a command within "normal mode" > it requires the ":normal" workaround. > > see also: > :help :g > :help :s > :help :bar > :help :normal > :help gJ > > and maybe there is a way to re-use the pattern from > the global command within the substitution command. > > Sven > > -- > -- > 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+unsubscr...@googlegroups.com. > For more options, visit https://groups.google.com/groups/opt_out. >
A simpler way: :%s/-<br\/>\_s*// \_s matches for space or the end of line: :help \_s Regards, Marcin -- -- 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+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.