Yggdroot / indentLine

A vim plugin to display the indention levels with thin vertical lines
MIT License
4.13k stars 227 forks source link

Spacing and highlight-based indentLine #361

Open savchenko opened 3 years ago

savchenko commented 3 years ago

Consider the following example:

image

  1. First indent from the left is expected.
  2. Second might be desirable by some.
  3. All others are redundant.

Is it possible to avoid drawing indents if:

  1. Spacing between lines if less than N.
  2. The rest of the line has Comment highlight-group applied to it.

Both options can be independent from each other.

Yggdroot commented 3 years ago

https://github.com/Yggdroot/indentLine/blob/5617a1cf7d315e6e6f84d825c85e3b669d220bfa/doc/indentLine.txt#L77-L82

savchenko commented 3 years ago

@Yggdroot , I've read the doc and tried the proposed parameter, but don't see how it is applicable here.

g:indentLine_indentLevel allows to limit number of indent lines drawn counting from the leftmost one.

Consider this valid case where everything is looking well:

image

And now with the different comment style:

image

If I would limit g:indentLine_indentLevel to 3, things will look better for this specific section only:

image

But what about rest of the code? Say we introduce a nested_var:

image

This illustrates why allowing to limit by the spacing between the lines is useful. Additional check "if line contains only spaces and Comment highlight group" will help as well.

Makes sense? :)