do not show indentLine if diff is set

This commit is contained in:
Yggdroot
2020-03-02 14:36:43 +08:00
parent bb548a975e
commit f9ebc9a811

View File

@@ -118,13 +118,16 @@ function! s:ResetConcealOption()
endif endif
endfunction endfunction
function! s:CheckDiff()
if &diff
call s:IndentLinesDisable()
call s:LeadingSpaceDisable()
endif
endfunction
"{{{1 function! s:IndentLinesEnable() "{{{1 function! s:IndentLinesEnable()
function! s:IndentLinesEnable() function! s:IndentLinesEnable()
if g:indentLine_newVersion if g:indentLine_newVersion
if &diff
return
endif
if exists("b:indentLine_enabled") && b:indentLine_enabled == 0 if exists("b:indentLine_enabled") && b:indentLine_enabled == 0
return return
endif endif
@@ -293,10 +296,6 @@ endfunction
"{{{1 function! s:LeadingSpaceEnable() "{{{1 function! s:LeadingSpaceEnable()
function! s:LeadingSpaceEnable() function! s:LeadingSpaceEnable()
if g:indentLine_newVersion if g:indentLine_newVersion
if &diff
return
endif
if exists("b:indentLine_leadingSpaceEnabled") && b:indentLine_leadingSpaceEnabled == 0 if exists("b:indentLine_leadingSpaceEnabled") && b:indentLine_leadingSpaceEnabled == 0
return return
endif endif
@@ -380,6 +379,8 @@ augroup indentLine
endif endif
autocmd BufWinEnter * call <SID>IndentLinesDisable() | call <SID>LeadingSpaceDisable() | call <SID>Setup() autocmd BufWinEnter * call <SID>IndentLinesDisable() | call <SID>LeadingSpaceDisable() | call <SID>Setup()
autocmd FileType * call <SID>Disable() autocmd FileType * call <SID>Disable()
autocmd OptionSet diff call <SID>IndentLinesDisable() | call s:LeadingSpaceDisable()
autocmd VimEnter * noautocmd windo call s:CheckDiff()
else else
autocmd BufWinEnter * call <SID>Setup() autocmd BufWinEnter * call <SID>Setup()
autocmd User * if exists("b:indentLine_enabled") || exists("b:indentLine_leadingSpaceEnabled") | autocmd User * if exists("b:indentLine_enabled") || exists("b:indentLine_leadingSpaceEnabled") |
@@ -388,6 +389,8 @@ augroup indentLine
autocmd BufUnload * let b:indentLine_enabled = 0 | let b:indentLine_leadingSpaceEnabled = 0 autocmd BufUnload * let b:indentLine_enabled = 0 | let b:indentLine_leadingSpaceEnabled = 0
autocmd SourcePre $VIMRUNTIME/syntax/nosyntax.vim doautocmd indentLine BufUnload autocmd SourcePre $VIMRUNTIME/syntax/nosyntax.vim doautocmd indentLine BufUnload
autocmd FileChangedShellPost * doautocmd indentLine BufUnload | call <SID>Setup() autocmd FileChangedShellPost * doautocmd indentLine BufUnload | call <SID>Setup()
autocmd OptionSet diff call <SID>IndentLinesDisable() | call s:LeadingSpaceDisable()
autocmd VimEnter * noautocmd windo call s:CheckDiff()
endif endif
augroup END augroup END