From 74c8bdeecb9a0ae7c9642394134aea4d0a89b0a8 Mon Sep 17 00:00:00 2001 From: Sergey Vlasov Date: Thu, 11 Oct 2012 15:51:43 +0300 Subject: [PATCH] Added new `g:indent_guides_soft_pattern` option --- autoload/indent_guides.vim | 2 +- doc/indent_guides.txt | 10 ++++++++++ plugin/indent_guides.vim | 2 ++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/autoload/indent_guides.vim b/autoload/indent_guides.vim index cad7c92..ad98247 100644 --- a/autoload/indent_guides.vim +++ b/autoload/indent_guides.vim @@ -42,7 +42,7 @@ function! indent_guides#enable() for l:level in range(s:start_level, s:indent_levels) let l:group = 'IndentGuides' . ((l:level % 2 == 0) ? 'Even' : 'Odd') let l:column_start = (l:level - 1) * s:indent_size + 1 - let l:soft_pattern = indent_guides#indent_highlight_pattern('\s', l:column_start, s:guide_size) + let l:soft_pattern = indent_guides#indent_highlight_pattern(g:indent_guides_soft_pattern, l:column_start, s:guide_size) let l:hard_pattern = indent_guides#indent_highlight_pattern('\t', l:column_start, s:indent_size) " define the higlight patterns and add to matches list diff --git a/doc/indent_guides.txt b/doc/indent_guides.txt index 9a208be..202e8c4 100644 --- a/doc/indent_guides.txt +++ b/doc/indent_guides.txt @@ -141,6 +141,16 @@ Default: 1. Values: 0 or 1. > let g:indent_guides_space_guides = 0 < + +------------------------------------------------------------------------------ + *'indent_guides_soft_pattern'* +Use this option to explicitly specify a pattern for indentation. For example +to match spaces only in the beginning of line use ' ' pattern. + +Default: '\s'. Values: vim regexp. +> + let g:indent_guides_soft_pattern = ' ' +< ------------------------------------------------------------------------------ *'indent_guides_enable_on_vim_startup'* Use this option to control whether the plugin is enabled on Vim startup. diff --git a/plugin/indent_guides.vim b/plugin/indent_guides.vim index 642553b..94cfed1 100644 --- a/plugin/indent_guides.vim +++ b/plugin/indent_guides.vim @@ -53,6 +53,8 @@ call s:InitVariable('g:indent_guides_start_level', 1 ) call s:InitVariable('g:indent_guides_enable_on_vim_startup', 0 ) call s:InitVariable('g:indent_guides_debug', 0 ) call s:InitVariable('g:indent_guides_space_guides', 1 ) +call s:InitVariable('g:indent_guides_soft_pattern', '\s') + " Default mapping if !hasmapto('IndentGuidesToggle', 'n') && maparg('ig', 'n') == ''