2

When formatting paragraphs with concealed elements, the formatting program does not take into account that some characters are invisible, and renders some lines shorter than the rest, when using the justified text option (set formatprg=par\ j). Might there be an easy way to fix this?

  • 3
    I think you try too hard to make Vim a WYSIWYG TeX (probably) Processor :) The only way I see your problem solved would be to use formatexpr instead of formatprg, and by using some Vim functions (synconcealed() ?) that allow you to somehow get access to the displayed text and pass it to the formatexpr in order to be formated by its looks, instead of its true contents. But I'm no guru, who knows what other tricks Vim hides? – VanLaser Feb 14 '16 at 15:17
  • @VanLaser, yes I think my solution for now will be to stop trying to use the conceal feature. – Toothrot Feb 14 '16 at 15:22
  • Not sure if feasible, but you could try to make & use conceal rules that maintain the length of the concealed text, e.g. <space><space><greek alpha char><space><space> instead of alpha – VanLaser Feb 14 '16 at 15:29
  • 2
    I'm mildly curious as to why you would care so much about paragraph formatting that ultimately will have no effect on the output. In (La)TeX I just let it hard wrap at X columns and leave it be. (I'm just assuming TeX going by your previous question.) – muru Feb 14 '16 at 16:53
  • @muru, ragged margins make me dizzy. – Toothrot Feb 14 '16 at 16:57
2

There is no solution for that and Bram even stated, he does not consider that to be a bug. Concealing is only about the visual appearance and won't change the underlying text property. Besides being hard to get right (and possibly even slow), one would probably have many unwanted side effects, that are not wanted.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.