mirror of
https://github.com/Yggdroot/indentLine.git
synced 2025-12-07 04:34:26 +08:00
add choice for user to select better performance
This commit is contained in:
@@ -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,6 +97,12 @@ function! <SID>SetIndentLine()
|
||||
let b:indentLine_enabled = 1
|
||||
let space = &l:shiftwidth == 0 ? &l:tabstop : &l:shiftwidth
|
||||
|
||||
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
|
||||
@@ -101,6 +111,7 @@ function! <SID>SetIndentLine()
|
||||
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! <SID>ResetWidth(...)
|
||||
@@ -111,6 +122,7 @@ function! <SID>ResetWidth(...)
|
||||
|
||||
if exists("b:indentLine_enabled")
|
||||
syn clear IndentLine
|
||||
syn clear IndentLineSpace
|
||||
endif
|
||||
call <SID>SetIndentLine()
|
||||
endfunction
|
||||
@@ -167,6 +179,7 @@ autocmd BufWinEnter * call <SID>Setup()
|
||||
autocmd BufRead,BufNewFile,ColorScheme * call <SID>InitColor()
|
||||
autocmd Syntax * if exists("b:indentLine_set") | call <SID>InitColor() | call <SID>SetIndentLine() | endif
|
||||
|
||||
|
||||
command! -nargs=? IndentLinesReset call <SID>ResetWidth(<f-args>)
|
||||
command! IndentLinesToggle call <SID>IndentLinesToggle()
|
||||
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user