Wednesday, May 27, 2015

Re: reformatting comments

On Wednesday, May 27, 2015 at 10:06:11 AM UTC-5, Christian Brabandt wrote:
> Hi,
> Can someone explain this behaviour?
>
> vim -u NONE -N --cmd ':set comments=e:%% tw=20' -c 'call setline(1, "%%
> ".repeat("foobar ", 10))' -c 'norm! Vgq'
>
> Output:
> ,----
> | %% foobar foobar foobar foobar foobar foobar foobar foobar foobar foobar
> `----
> Note: not reformated to fit into the textwidth
>
> Expected Output:
> ,----
> | %% foobar foobar
> | %% foobar foobar
> | %% foobar foobar
> | %% foobar foobar
> | %% foobar foobar
> `----
> (Reformated to fit into textwidth, the comment leader might be left
> away)
>

Why do you expect this behavior? You're specifying only the end part of a 3-part comment, making it an invalid entry. From :help format-comments:

> A three-piece comment must always be given as start,middle,end, with no
other
> parts in between. An example of a three-piece comment is
> sr:/*,mb:*,ex:*/

If I change "e:%%" to just ":%%" then the example works as expected, for me.

--
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: