diff --git a/after/plugin/indentLine.vim b/after/plugin/indentLine.vim index 5635052..89da49f 100644 --- a/after/plugin/indentLine.vim +++ b/after/plugin/indentLine.vim @@ -56,6 +56,10 @@ if !exists("g:indentLine_maxLines") let g:indentLine_maxLines = 3000 endif +if !exists("g:indentLine_faster") + let g:indentLine_faster = 0 +endif + if !exists("g:indentLine_noConcealCursor") set concealcursor=inc endif @@ -93,14 +97,21 @@ function! SetIndentLine() let b:indentLine_enabled = 1 let space = &l:shiftwidth == 0 ? &l:tabstop : &l:shiftwidth - if g:indentLine_showFirstIndentLevel - exec 'syn match IndentLine /^ / containedin=ALL conceal cchar=' . g:indentLine_first_char - endif + if g:indentLine_faster + exec 'syn match IndentLineSpace /^\s\+/ contains=IndentLine' + exec 'syn match IndentLine /^ / containedin=ALL contained conceal cchar=' . g:indentLine_char + exec 'syn match IndentLine / \{'.(space-1).'}\zs / containedin=ALL contained conceal cchar=' . g:indentLine_char + exec 'syn match IndentLine /\t\zs / containedin=ALL contained conceal cchar=' . g:indentLine_char + else + if g:indentLine_showFirstIndentLevel + 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.pattern.' / containedin=ALL conceal cchar=' . g:indentLine_char - endfor + 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.pattern.' / containedin=ALL conceal cchar=' . g:indentLine_char + endfor + endif endfunction "{{{1 function! ResetWidth(...) @@ -111,6 +122,7 @@ function! ResetWidth(...) if exists("b:indentLine_enabled") syn clear IndentLine + syn clear IndentLineSpace endif call SetIndentLine() endfunction @@ -167,6 +179,7 @@ autocmd BufWinEnter * call Setup() autocmd BufRead,BufNewFile,ColorScheme * call InitColor() autocmd Syntax * if exists("b:indentLine_set") | call InitColor() | call SetIndentLine() | endif + command! -nargs=? IndentLinesReset call ResetWidth() command! IndentLinesToggle call IndentLinesToggle() diff --git a/doc/indentLine.txt b/doc/indentLine.txt index b834b43..0d29cc5 100644 --- a/doc/indentLine.txt +++ b/doc/indentLine.txt @@ -90,6 +90,11 @@ g:indentLine_maxLines *g:indentLine_maxLines* the performance better. Default value is 3000. +g:indentLine_faster *g:indentLine_faster* + If you want the performance better, you can set the value as + 1, default value is 0. But better performance may bring little + issue with it. + g:indentLine_noConcealCursor *g:indentLine_noConcealCursor* This variable toggles cursor lines behavior. If variable exists, then cursorline will be above conceal chars.