Hello,

I have tried to write a function for formatting TeX files using the new
'formatexpr' function. Goal is (of course) to keep matching dollars on
one line and not to use the insert mapping of <space>. 

I have more or less found a good solution. The only problem is that this
solution interacts quite badly with the undo mechanism of vim. The
function I wrote uses vim internal formatting algorithm when no special
treatment is necessary (returns 1) otherwise it does the formatting job
and returns 0. In the second case it uses append() function to add a new
line under the current line.

I have feeling that this append() function is not recorded for the undo.
Essentially, every use of append() for formatting during an insertion of
a long paragraph results in one line that is left in the file after
undoing this insertion. 

I can post the scripts that I use if it is necessary, but maybe the
description is sufficient to understand the problem. 

It is also maybe possible to use different means to append the line, but
I find append() to be the best one.   

This problem appears in VIM 7.0c10. I had no time to compile the final
version, so sorry if this problem has been already resolved. 

Thanks,

                Jiri


Reply via email to