Enable auto redraw indentLines

Trigger redraw after set shiftwidth or tabstop
This commit is contained in:
Mike
2020-03-05 13:24:52 -08:00
parent dfc850b7e4
commit c1cacf2e46
2 changed files with 33 additions and 5 deletions

View File

@@ -254,7 +254,7 @@ endfunction
"{{{1 function! s:ResetWidth(...) "{{{1 function! s:ResetWidth(...)
function! s:ResetWidth(...) function! s:ResetWidth(...)
if 0 < a:0 if 0 < a:0
let &l:shiftwidth = a:1 noautocmd let &l:shiftwidth = a:1
endif endif
let b:indentLine_enabled = 1 let b:indentLine_enabled = 1
@@ -262,6 +262,26 @@ function! s:ResetWidth(...)
call s:IndentLinesEnable() call s:IndentLinesEnable()
endfunction endfunction
"{{{1 function! s:AutoResetWidth()
function! s:AutoResetWidth()
let l:enable = get(
\ b:,
\ 'indentLine_enabled',
\ get(g:, 'indentLine_enabled', 1)
\)
let g:indentLine_autoResetWidth = get(g:, 'indentLine_autoResetWidth', 1)
if l:enable != 1 || g:indentLine_autoResetWidth != 1
return
endif
let b:indentLine_enabled = l:enable
call s:IndentLinesDisable()
call s:IndentLinesEnable()
endfunction
"{{{1 function! s:Filter() "{{{1 function! s:Filter()
function! s:Filter() function! s:Filter()
if index(g:indentLine_fileTypeExclude, &filetype) != -1 if index(g:indentLine_fileTypeExclude, &filetype) != -1
@@ -400,6 +420,7 @@ augroup indentLine
autocmd FileType * call s:Disable() autocmd FileType * call s:Disable()
if exists("##OptionSet") if exists("##OptionSet")
autocmd OptionSet diff call s:ToggleOnDiff() autocmd OptionSet diff call s:ToggleOnDiff()
autocmd OptionSet shiftwidth,tabstop noautocmd call s:AutoResetWidth()
endif endif
autocmd VimEnter * call s:VimEnter() autocmd VimEnter * call s:VimEnter()
else else
@@ -412,6 +433,7 @@ augroup indentLine
autocmd FileChangedShellPost * doautocmd indentLine BufUnload | call s:Setup() autocmd FileChangedShellPost * doautocmd indentLine BufUnload | call s:Setup()
if exists("##OptionSet") if exists("##OptionSet")
autocmd OptionSet diff call s:ToggleOnDiff() autocmd OptionSet diff call s:ToggleOnDiff()
autocmd OptionSet shiftwidth,tabstop noautocmd call s:AutoResetWidth()
endif endif
autocmd VimEnter * call s:VimEnter() autocmd VimEnter * call s:VimEnter()
endif endif

View File

@@ -105,7 +105,7 @@ g:indentLine_fileTypeExclude *g:indentLine_fileTypeExclude*
e.g. let g:indentLine_fileTypeExclude = ['text', 'sh'] e.g. let g:indentLine_fileTypeExclude = ['text', 'sh']
Default value is [] which means no file types are excluded. Default value is [] which means no file types are excluded.
g:indentLine_bufTypeExclude *g:indentLine_bufTypeExclude* g:indentLine_bufTypeExclude *g:indentLine_bufTypeExclude*
This variable specify a list of buffer types. This variable specify a list of buffer types.
When opening these types of buffers, the plugin is disabled When opening these types of buffers, the plugin is disabled
by default. by default.
@@ -136,14 +136,14 @@ g:indentLine_setConceal
set this value to 0. set this value to 0.
Default value is 1. Default value is 1.
g:indentLine_concealcursor *g:indentLine_concealcursor* g:indentLine_concealcursor *g:indentLine_concealcursor*
This variable toggles cursor lines behavior. If variable This variable toggles cursor lines behavior. If variable
exists and is empty, that is, set to '', then the indentlines exists and is empty, that is, set to '', then the indentlines
will not show up in the cursorline. will not show up in the cursorline.
See *concealcursor*. See *concealcursor*.
Default value is 'inc'. Default value is 'inc'.
g:indentLine_conceallevel *g:indentLine_conceallevel* g:indentLine_conceallevel *g:indentLine_conceallevel*
This variable toggles the concealing behavior. This variable toggles the concealing behavior.
See *conceallevel*. See *conceallevel*.
Default value is '2'. Default value is '2'.
@@ -160,6 +160,12 @@ g:indentLine_leadingSpaceEnabled *g:indentLine_leadingSpaceEnable
g:indentLine_defaultGroup *g:indentLine_defaultGroup* g:indentLine_defaultGroup *g:indentLine_defaultGroup*
Specify a highlight group to use for default values Specify a highlight group to use for default values
of g:indentLine_[bg]color_(term|gui) of g:indentLine_[bg]color_(term|gui)
g:indentLine_autoResetWidth *g:indentLine_autoResetWidth*
Specify whether to auto redraw the indentLines after
'shiftwidth' or 'tabstop' change.
Default value is 1.
============================================================================== ==============================================================================
COMMANDS *indentLine-commands* COMMANDS *indentLine-commands*