HTML comment :join weirdness

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
BPJ
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

HTML comment :join weirdness

BPJ
I have an HTML file with lots of pairs of lines like these:

     <td colspan="1" rowspan="2" title="pb">bb</td>
     <!-- pb bb -->

I want to join the two lines so that the comment comes at the end
of the preceding line so I do `:g/<!--/-1j`. It works in that the
two lines are joined, but the `<!--` disappears so that I get

     <td colspan="1" rowspan="2" title="pb">bb</td> pb bb -->
                                                   ^
                                                   |
     Nothing here! --------------------------------+

I found a workaround

     :g/<!-- /s//&&
     :g/<!--/-1

but I can't shake the feeling that this is not correct behavior,
or is it?

TIA,

/bpj

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: HTML comment :join weirdness

Christian Brabandt

On So, 21 Mai 2017, BPJ wrote:

> I have an HTML file with lots of pairs of lines like these:
>
>     <td colspan="1" rowspan="2" title="pb">bb</td>
>     <!-- pb bb -->
>
> I want to join the two lines so that the comment comes at the end of the
> preceding line so I do `:g/<!--/-1j`. It works in that the two lines are
> joined, but the `<!--` disappears so that I get
>
>     <td colspan="1" rowspan="2" title="pb">bb</td> pb bb -->
>                                                   ^
>                                                   |
>     Nothing here! --------------------------------+
>
> I found a workaround
>
>     :g/<!-- /s//&&
>     :g/<!--/-1
>
> but I can't shake the feeling that this is not correct behavior, or is it?

Please check your formatoptions setting.

Best,
Christian
--
Daseinszweck des Kindes ist es, sein eigenes Leben zu leben.
                -- Alexander Sutherland Neill

--
--
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 [hidden email].
For more options, visit https://groups.google.com/d/optout.
Loading...