Thursday, January 15, 2015

Re: conceal and wrapping

On 2015-01-14, Christian Brabandt wrote:
> On Mi, 14 Jan 2015, Christian Brabandt wrote:
>
> > Hi Gary!
> >
> > On Mi, 14 Jan 2015, Gary Johnson wrote:
> >
> > > Given a line longer than the screen width so that it wraps at the
> > > screen edge, is it expected that concealing the first part of a line
> > > moves the line to the left but does not change the point in the line
> > > where it wraps?
> >
> > Yes, that is expected. See issue 260:
> > https://code.google.com/p/vim/issues/detail?id=260
>
> But here is a different approach. Use
> :setl fdm=expr fex='>1' fml=0
> :let &l:fdt='matchstr(getline(v:foldstart).repeat(" ",70),''^.\{70}'').repeat(" ",10)'
>
> This has only the drawback of disabling syntax highlighting.
>
> With a fancier foldtext setting you can also almost do anything (e.g.
> strip the common path or so).

Clever! I would never have thought to use 'foldtext' to format the
display of lines like that.

It took me a while to get it to work. I changed "fex" to "fde"
('fex' is 'formatexpr') and added the optional third argument to
matchstr(), which I set to the length of the common path.

I like the behavior of conceal better for this application, but I'll
keep this trick in mind for other problems. Thanks.

Regards,
Gary

--
--
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:

Post a Comment