make performance better, fix issue #13

thanks to adonis0147
This commit is contained in:
Yggdroot
2013-04-18 18:53:18 +08:00
parent 7be63e55a7
commit 3d30f26c33
2 changed files with 12 additions and 1 deletions

View File

@@ -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! <SID>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

View File

@@ -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*