diff --git a/after/plugin/indentLine.vim b/after/plugin/indentLine.vim index b123ea2..42f6d04 100644 --- a/after/plugin/indentLine.vim +++ b/after/plugin/indentLine.vim @@ -23,7 +23,8 @@ let g:indentLine_fileTypeExclude = get(g:,'indentLine_fileTypeExclude',[]) let g:indentLine_bufNameExclude = get(g:,'indentLine_bufNameExclude',[]) let g:indentLine_showFirstIndentLevel = get(g:,'indentLine_showFirstIndentLevel',0) let g:indentLine_maxLines = get(g:,'indentLine_maxLines',3000) -let g:indentLine_setColors = get(g:,'indentLine_setColors',1) +let g:indentLine_setColors = get(g:,'indentLine_setColors',1) +let g:indentLine_faster = get(g:,'indentLine_faster',0) "{{{1 function! s:InitColor() function! s:InitColor() @@ -60,11 +61,19 @@ function! s:SetIndentLine() let b:indentLine_enabled = 1 let space = &l:shiftwidth is 0 ? &l:tabstop : &l:shiftwidth - execute 'syntax match IndentLineSpace /^\s\+/ containedin=ALL contains=IndentLine' - execute 'syntax match IndentLine / \{'.(space-1).'}\zs / contained conceal cchar=' . g:indentLine_char - execute 'syntax match IndentLine /\t\zs / contained conceal cchar=' . g:indentLine_char if g:indentLine_showFirstIndentLevel - execute 'syntax match IndentLine /^ / contained conceal cchar=' . g:indentLine_first_char + execute 'syntax match IndentLine /^ / containedin=ALL conceal cchar=' . g:indentLine_first_char + endif + + if g:indentLine_faster + execute 'syntax match IndentLineSpace /^\s\+/ containedin=ALL contains=IndentLine' + execute 'syntax match IndentLine / \{'.(space-1).'}\zs / contained conceal cchar=' . g:indentLine_char + execute 'syntax match IndentLine /\t\zs / contained conceal cchar=' . g:indentLine_char + else + let pattern = line('$') < g:indentLine_maxLines ? 'v' : 'c' + for i in range(space+1, space * g:indentLine_indentLevel + 1, space) + execute 'syntax match IndentLine /\%(^\s\+\)\@<=\%'.i.pattern.' / containedin=ALL conceal cchar=' . g:indentLine_char + endfor endif endfunction @@ -76,7 +85,6 @@ function! s:ResetWidth(...) if exists("b:indentLine_enabled") syntax clear IndentLine - syntax clear IndentLineSpace endif call s:SetIndentLine() endfunction @@ -137,8 +145,7 @@ endfunction augroup indentLine autocmd! autocmd BufWinEnter * call Setup() - autocmd BufRead,BufNewFile,ColorScheme * call InitColor() - autocmd Syntax * if exists("b:indentLine_set") && get(b:, "indentLine_enabled", 0) | call InitColor() | call SetIndentLine() | endif + autocmd BufRead,BufNewFile,ColorScheme,Syntax * call InitColor() augroup END "{{{1 commands 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.