From 3d30f26c33a67b6bd947eba6e6b2c3bb574f9445 Mon Sep 17 00:00:00 2001 From: Yggdroot Date: Thu, 18 Apr 2013 18:53:18 +0800 Subject: [PATCH] make performance better, fix issue #13 thanks to adonis0147 --- after/plugin/indentLine.vim | 7 ++++++- doc/indentLine.txt | 6 ++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/after/plugin/indentLine.vim b/after/plugin/indentLine.vim index 430ffb8..9a53e9c 100644 --- a/after/plugin/indentLine.vim +++ b/after/plugin/indentLine.vim @@ -52,6 +52,10 @@ if !exists("g:indentLine_showFirstIndentLevel") let g:indentLine_showFirstIndentLevel = 0 endif +if !exists("g:indentLine_maxLines") + let g:indentLine_maxLines = 3000 +endif + set conceallevel=1 set concealcursor=inc @@ -90,8 +94,9 @@ function! SetIndentLine() exec 'syn match IndentLine /^ / containedin=ALL conceal cchar=' . g:indentLine_first_char endif + let pattern = line('$') < g:indentLine_maxLines ? 'v' : 'c' for i in range(space+1, space * g:indentLine_indentLevel + 1, space) - exec 'syn match IndentLine /\(^\s\+\)\@<=\%'.i.'v / containedin=ALL conceal cchar=' . g:indentLine_char + exec 'syn match IndentLine /\%(^\s\+\)\@<=\%'.i.pattern.' / containedin=ALL conceal cchar=' . g:indentLine_char endfor endfunction diff --git a/doc/indentLine.txt b/doc/indentLine.txt index 96296d0..0dcac7e 100644 --- a/doc/indentLine.txt +++ b/doc/indentLine.txt @@ -84,6 +84,12 @@ g:indentLine_bufNameExclude *g:indentLine_bufNameExclude* e.g. let g:indentLine_bufNameExclude = ['_.*', 'NERD_tree.*'] Default value is []. +g:indentLine_maxLines *g:indentLine_maxLines* + This variable specify a number, when the number of buffer's + lines exceed it, the plugin try to use another pattern to make + the performance better. + Default value is 3000. + ============================================================================== COMMANDS *indentLine-commands*