vim-indent-guides icon indicating copy to clipboard operation
vim-indent-guides copied to clipboard

Do not guide indentions below length x

Open ghost opened this issue 11 years ago • 4 comments
trafficstars

Sometimes I have code that is just a few lines long so it would be nice to have the option to set a minimal indention-length.

E.g.:

class ClassExample
  def example
    return 0
  end
  def example2
    puts ex
    puts 0
    puts test
  end
end

example and example2 are extremely short an guided indentions don't look nice - also they're distracting.

This may looks similar to Issue #39, but it isn't - though that would be nice too.

ghost avatar Apr 24 '14 15:04 ghost

You mean this isn't just using this setting?

let g:indent_guides_start_level = 3

NewAlexandria avatar Apr 24 '14 18:04 NewAlexandria

No, that setting would define that guiding starts at the third tab (sticking to your example). I'll make my point clearer:

Think of the dashes as the highlighning:

class ClassExample
- def example
- - return 0
- end
- def example2
- - puts ex
- - puts 0
- - puts test
- end
- def example3
- - puts some more
- - puts 1+1
- - puts some
- - puts some
- - puts some
- - puts some
- end
end

This is how it looks like currently, but I suggested a setting, e.g. g:indent_guides_start_minlines = If we set this to 5 it would look like this:

class ClassExample
- def example
-   return 0
- end
- def example2
-   puts ex
-   puts 0
-   puts test
- end
- def example3
- - puts some more
- - puts 1+1
- - puts some
- - puts some
- - puts some
- - puts some
- end
end

Since the number of lines to be highlighted have to more or equal to 5 - example and example2 don't meet this requirement, example3 (since it is six lines long) does and thus get's guided.

ghost avatar Apr 24 '14 19:04 ghost

oh. That's more clear. and somewhat interesting.

My first thought is to be against it because it's inconsistent.

If you want to make the change, I cannot recommend much with my vimscript-fu at this time. The change you want (count lines, act after some init var number of lines) probably goes here

NewAlexandria avatar Apr 24 '14 19:04 NewAlexandria

I'd love this feature, personally, but would have it set to a value of 2 for myself. more than 2 lines, I'd want hilighted.

spikegrobstein avatar May 13 '15 23:05 spikegrobstein