Yakov Lerner wrote:
On 5/14/07, Václav Šmilauer <[EMAIL PROTECTED]> wrote:
Hello,

I submit patch that implements the 'breakindent' feature. It is on vim todo
list, since the moment I tried a few years ago (see e.g.
http://marc.info/?l=vim-dev&m=109921292009721&w=1). Picture says what it's
about (showbreak is aligned with first non-whitespace):

http://beta.arcig.cz/~eudoxos/vim7/breakindent1.png
http://beta.arcig.cz/~eudoxos/vim7/breakindent2.png

I tried to address all Bram's comments he had to the original patch, like
coding style, functionality in diff mode, selections etc. I had to change a
few prototypes to pass line number.

There is one bug and some (easily fixable) limitations:

* BUG: there is some weird interaction with quickfix window, where very
rarely there is the "ml_get(): invalid line number" error. I think it is
caused by passing wrong line number thgouth the *chartabsize* & family
routines (line in the main buffer interpreted as line in the quickfix window
or something like that), but I am not sure.

* No test case. This will be added once there is enough interest from
developers (there _is_ documentation).

* The bri_min variable is not exposed to userspace yet, is set to 20 in the
code. If the rest is considered ready for inclusion, I will add a
user-serrable variable for that.

The patch is against current svn (vim7, rev. 288). Any comments are welcome.

I played with the patch. Works smoothly, I did not find any deficiencies.

I have one wish though.

It would be nice if I could specificy additional indent for continuation lines. You make indent for continuation line *EQUAL* to indent of the 1st screen line.
Let's say  you have 3 consequitive long lines with same indent, and
each lines wrapped into 4 screen lines. With current 'breakindent'
patch, you see 8 lines
with *same* indent. It's not that easy to see beginning of each long lines.
If breakindent would be numeric value N which meant assign indent K+N
to continuation indent, where K is indent of the line itself. Current
breakindent corresponds to N==0. But I'd probably prefer N=1 or N==2.

Just my 2 cents
Thanks
Yakov
****************** nobreakindent
 line1line1line1line1
line1line1line1line
 line2line2line2line2
line2line2line2line
****************** breakindent=0
 line1line1line1line1
 line1line1line1line
 line2line2line2line2
 line2line2line2line
****************** breakindent=2
 line1line1line1line1
   line1line1line1line
 line2line2line2line2
   line2line2line2line
******************



With this change plus 'linebreak' on, it could be made to simulate "French" paragrah style for text, where the first line of a paragraph starts maybe 1em or so right of the left margin (but with no blank line, unlike "American" paragraph style which uses flush-left alignment with a blank line between paragraphs).

Thus breakindent=0 "flush left" (as above)
breakindent=-3 "French style with first line indented 3 spaces", as follows:

        The quick brown fox jumps over the lazy dog. The quick
     brown fox jumps over the lazy dog. The quick brown fox jumps
     over the lazy dog.
        Line two starts here; neither line goes back to the left
     margin of the Vim window. The lazy dog is jumped over by the
     quick brown fox. The lazy dog is jumped over by the quick
     brown fox. The lazy dog is jumped over by the quick brown fox.

breakindent=2 "all lines except the first indented 2 spaces" (as you show above)

A single option cannot be both boolean and integer; if a negative number is greater than the 1st line indent, don't go back farther left than the left margin of the window; thus breakindent=-9999999 would agree with your first example.


Best regards,
Tony.
--
Sex is a natural bodily process, like a stroke.

Reply via email to