From 568ef5fd25468a58723b50cf40a48c5dcb46c802 Mon Sep 17 00:00:00 2001 From: Jan Larres Date: Mon, 1 Oct 2012 22:59:53 +1300 Subject: [PATCH] Make the indent configurable, closes #110 --- autoload/tagbar.vim | 11 ++++++----- doc/tagbar.txt | 12 ++++++++++++ plugin/tagbar.vim | 4 ++++ 3 files changed, 22 insertions(+), 5 deletions(-) diff --git a/autoload/tagbar.vim b/autoload/tagbar.vim index 4a9ac1d..e9e8e93 100644 --- a/autoload/tagbar.vim +++ b/autoload/tagbar.vim @@ -2499,7 +2499,8 @@ function! s:PrintKinds(typeinfo, fileinfo) abort " only if they are not scope-defining tags (since " those already have an identifier) if !has_key(a:typeinfo.kind2scope, ckind.short) - silent put =' [' . ckind.long . ']' + silent put =repeat(' ', g:tagbar_indent + 2) . + \ '[' . ckind.long . ']' " Add basic tag to allow folding when on the " header line let headertag = s:BaseTag.New(ckind.long) @@ -2544,7 +2545,7 @@ function! s:PrintKinds(typeinfo, fileinfo) abort if !kindtag.isFolded() for tag in curtags let str = tag.strfmt() - silent put =' ' . str + silent put =repeat(' ', g:tagbar_indent) . str " Save the current tagbar line in the tag for easy " highlighting access @@ -2567,7 +2568,7 @@ endfunction " s:PrintTag() {{{2 function! s:PrintTag(tag, depth, fileinfo, typeinfo) abort " Print tag indented according to depth - silent put =repeat(' ', a:depth * 2) . a:tag.strfmt() + silent put =repeat(' ', a:depth * g:tagbar_indent) . a:tag.strfmt() " Save the current tagbar line in the tag for easy " highlighting access @@ -2585,8 +2586,8 @@ function! s:PrintTag(tag, depth, fileinfo, typeinfo) abort " are not scope-defining tags (since those already have an " identifier) if !has_key(a:typeinfo.kind2scope, ckind.short) - silent put =' ' . repeat(' ', a:depth * 2) . - \ '[' . ckind.long . ']' + silent put =repeat(' ', (a:depth + 1) * g:tagbar_indent + 2) + \ . '[' . ckind.long . ']' " Add basic tag to allow folding when on the header line let headertag = s:BaseTag.New(ckind.long) let headertag.parent = a:tag diff --git a/doc/tagbar.txt b/doc/tagbar.txt index 2adb476..ed564f8 100644 --- a/doc/tagbar.txt +++ b/doc/tagbar.txt @@ -408,6 +408,18 @@ Example: let g:tagbar_compact = 1 < + *g:tagbar_indent* +g:tagbar_indent~ +Default: 2 + +The number of spaces by which each level is indented. This allows making the +display more compact or more spacious. + +Example: +> + let g:tagbar_indent = 1 +< + *g:tagbar_expand* g:tagbar_expand~ Default: 0 diff --git a/plugin/tagbar.vim b/plugin/tagbar.vim index ad7c3c8..6e04099 100644 --- a/plugin/tagbar.vim +++ b/plugin/tagbar.vim @@ -66,6 +66,10 @@ if !exists('g:tagbar_compact') let g:tagbar_compact = 0 endif +if !exists('g:tagbar_indent') + let g:tagbar_indent = 2 +endif + if !exists('g:tagbar_expand') let g:tagbar_expand = 0 endif