Merge pull request #294 from Mike325/autoredraw

Enable auto redraw indentLines
This commit is contained in:
Yggdroot
2020-03-06 10:01:05 +08:00
committed by GitHub
2 changed files with 33 additions and 5 deletions

View File

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

View File

@@ -105,7 +105,7 @@ g:indentLine_fileTypeExclude *g:indentLine_fileTypeExclude*
e.g. let g:indentLine_fileTypeExclude = ['text', 'sh']
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.
When opening these types of buffers, the plugin is disabled
by default.
@@ -136,14 +136,14 @@ g:indentLine_setConceal
set this value to 0.
Default value is 1.
g:indentLine_concealcursor *g:indentLine_concealcursor*
g:indentLine_concealcursor *g:indentLine_concealcursor*
This variable toggles cursor lines behavior. If variable
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*.
Default value is 'inc'.
g:indentLine_conceallevel *g:indentLine_conceallevel*
g:indentLine_conceallevel *g:indentLine_conceallevel*
This variable toggles the concealing behavior.
See *conceallevel*.
Default value is '2'.
@@ -160,6 +160,12 @@ g:indentLine_leadingSpaceEnabled *g:indentLine_leadingSpaceEnable
g:indentLine_defaultGroup *g:indentLine_defaultGroup*
Specify a highlight group to use for default values
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*