Added new global option to configure which indent level to start the indent guides from

This commit is contained in:
Nate Kane 2011-01-09 20:53:48 +10:00
parent 06d2b34874
commit 67398b8358
2 changed files with 6 additions and 3 deletions

View File

@ -39,7 +39,7 @@ function! indent_guides#enable()
" loop through each indent level and define a highlight pattern
" will automagically figure out whether to use tabs or spaces
for l:level in range(1, s:indent_levels)
for l:level in range(s:start_level, s:indent_levels)
let l:group = 'IndentGuides' . ((l:level % 2 == 0) ? 'Even' : 'Odd')
let l:pattern = '^\s\{' . (l:level * s:indent_size - s:indent_size) . '\}\zs'
let l:pattern .= '\s\{' . s:guide_size . '\}'
@ -177,6 +177,7 @@ function! indent_guides#init_script_vars()
let s:color_hex_pat = g:indent_guides_color_hex_pattern
let s:color_hex_bg_pat = g:indent_guides_color_hex_guibg_pattern
let s:color_name_bg_pat = g:indent_guides_color_name_guibg_pattern
let s:start_level = g:indent_guides_start_level
if s:debug
echo 's:indent_size = ' . s:indent_size
@ -188,6 +189,7 @@ function! indent_guides#init_script_vars()
echo 's:color_hex_pat = ' . s:color_hex_pat
echo 's:color_hex_bg_pat = ' . s:color_hex_bg_pat
echo 's:color_name_bg_pat = ' . s:color_name_bg_pat
echo 's:start_level = ' . s:start_level
endif
endfunction
@ -198,7 +200,7 @@ endfunction
" NOTE: Currently, this only works when soft-tabs are being used.
"
function! indent_guides#calculate_guide_size()
let l:guide_size = g:indent_guides_indent_guide_size
let l:guide_size = g:indent_guides_guide_size
let l:indent_size = indent_guides#get_indent_size()
if l:indent_size > 1 && l:guide_size >= 1

View File

@ -48,7 +48,8 @@ let g:indent_guides_color_name_guibg_pattern = "guibg='\\?\\zs[0-9A-Za-z ]\\+\\z
call s:InitVariable('g:indent_guides_indent_levels', 30)
call s:InitVariable('g:indent_guides_auto_colors', 1 )
call s:InitVariable('g:indent_guides_color_change_percent', 5 ) " ie. 5%
call s:InitVariable('g:indent_guides_indent_guide_size', 0 )
call s:InitVariable('g:indent_guides_guide_size', 0 )
call s:InitVariable('g:indent_guides_start_level', 1 )
call s:InitVariable('g:indent_guides_debug', 0 )
" Default mapping