Feature request: Make the indentation more compact #110

Closed
denilsonsa opened this Issue Sep 24, 2012 · 7 comments

Projects

None yet

3 participants

@denilsonsa

Currently, in C++ code, when we have a function inside a class inside a namespace, the function name is indented by 6 spaces. In my opinion, that's a waste of screen space. I'd prefer a more compact way to display it, indenting by 3 or 4 spaces should be enough.

@stardiviner

+1 should conside this way: #79

@majutsushi majutsushi closed this in 568ef5f Oct 1, 2012
@majutsushi
Owner

I've made the indentation configurable now, so you can set it to 1 to get the behaviour you want. I'm nut sure how conceal would have helped here, though ...

@denilsonsa

Great, thanks for the fast response!

It is a very good improvement, but it seems there is still a hard-coded minimum indent of 3 (or 2 + g:tagbar_indent). This means that:

▼ __anon1* : namespace
   foobar

Which leads to a minimum of 3-char left-margin. Can we reduce it to 2 or 1 character?

@majutsushi
Owner

If I understand you correctly you would want it to be displayed like this:

▼ __anon1* : namespace
 foobar

But that means that the child tag would be displayed left of the name of the parent tag, since the first two characters of the parent are the fold and visibility icons. I think that would be seriously confusing. And even if it wasn't there would still need to be enough space for the child tags to display those icons, like in this case:

▼ __anon1* : namespace
+foo
▼ bar
-baz

Here the foo and bar tags are supposed to be children of __anon1, but they can't be displayed at the same level since bar can't be moved further left. And baz is a child of bar, but is displayed at the same level as foo due to removing the icon space. So leaving out this space would just not work.

Even reducing the space to just 1 would not work:

▼ __anon1* : namespace
 +foo
▼ bar
 -baz

Here it is not clear whether bar is supposed to be a child of __anon1 or not.

With the current implementation and an indent of 1 it looks like this:

▼ __anon1* : namespace
  +foo
 ▼ bar
   -baz

This is still a bit cramped for my taste, but at least it's unambiguous and saves some space.

@denilsonsa

Okay, now I see your point. It makes complete sense, and I agree with what you explained.

On the other hand, if I work mostly with methods inside classes inside a namespace, that means most of the items will have an annoyingly high indent. May I suggest something else? An option to remove the visibility char. I believe that (together with 1-char-indentation) will lead to a compact enough display (and the visibility public/protected/private is not that important to me)

Thank you for your throughout explanation!

@majutsushi
Owner

I've now finally found some time to implement the ability to disable the visibility symbols (with the g:tagbar_show_visibility option). This should allow you to do what you want. Please let me know if there are any problems with it.

@denilsonsa

Thank you, it works very well!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment