Re: [vim/vim] ":join" truncates a comments "
On 2017-12-24, Gary Johnson wrote:
> On 2017-12-24, Gary Johnson wrote:
> > On 2017-12-24, AvianY wrote:
> > > I tried it and it works as it should with both NORC and NONE.
> >
> > For me, with NONE and with
> >
> > vim -u NORC --cmd "set rtp=/usr/local/share/vim/vim80" comment.xml
> >
> > it works fine. (My plugin dependencies prevent me from using just
> > NORC.) However, if I run just vim with no options and execute the
> > :join on line 3, I get this:
> >
> > <bar/> comment -->
> >
> > So there is something common between Dmitrii's configuration and
> > mine that causes this, but I don't know what. I also tried this,
> >
> > vim -u NORC --cmd "set rtp=/usr/local/share/vim/vim80" --cmd "filetype
> > plugin indent on" --cmd "syntax on" comment.xml
> >
> > but it also worked fine. Is a puzzlement. I'll poke around some
> > more.
>
> It happens when 'comments' is set to
>
> s:<!--,m: ,e:-->
>
> as it is for XML files, and 'formatoptions' includes 'j'.
>
> You can reproduce the problem this way:
>
> $ vim -u NONE comment.xml
> :let comments = "s:<!--,m: ,e:-->"
> :set fo+=j
> :3join
>
> where comment.xml contains Dmitrii's example.
The problem seems to be that get_last_leader_offset(), called at the
start of skip_comment(), sees the leading spaces in line 3 as the
middle part of the three-part comment defined in 'comments' and
identifies line 3 as a comment. Consequently, when line 4 is joined
to line 3, the comment leader of line 4 is removed.
The html filetype has the same 'comments' value and suffers the
same problem. I also discovered that the problem occurs when the
line on which the join is executed contains spaces anywhere, not
just at the start.
I don't understand the code and all the issues involved with
handling three-part comments well enough to have a solution, though.
Regards,
Gary
--
--
You received this message from the "vim_dev" 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_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.
- Re: [vim/vim] ":join" truncates a comments "&l... Gary Johnson
- Re: [vim/vim] ":join" truncates a comments &qu... Gary Johnson
- Re: [vim/vim] ":join" truncates a comments... Gary Johnson
