mirror of
https://github.com/Yggdroot/indentLine.git
synced 2025-12-09 05:24:49 +08:00
fix issue #102
This commit is contained in:
@@ -64,8 +64,20 @@ function! s:InitColor()
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
"{{{1 function! s:SetConcealOption()
|
||||||
|
function! s:SetConcealOption()
|
||||||
|
if ! exists("b:indentLine_ConcealOptionSet")
|
||||||
|
let b:indentLine_ConcealOptionSet = 1
|
||||||
|
if ! exists("g:indentLine_noConcealCursor")
|
||||||
|
setlocal concealcursor=inc
|
||||||
|
endif
|
||||||
|
setlocal conceallevel=2
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
"{{{1 function! s:SetIndentLine()
|
"{{{1 function! s:SetIndentLine()
|
||||||
function! s:SetIndentLine()
|
function! s:SetIndentLine()
|
||||||
|
call s:SetConcealOption()
|
||||||
let b:indentLine_enabled = 1
|
let b:indentLine_enabled = 1
|
||||||
let space = &l:shiftwidth is 0 ? &l:tabstop : &l:shiftwidth
|
let space = &l:shiftwidth is 0 ? &l:tabstop : &l:shiftwidth
|
||||||
|
|
||||||
@@ -91,7 +103,7 @@ function! s:ResetWidth(...)
|
|||||||
let &l:shiftwidth = a:1
|
let &l:shiftwidth = a:1
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if b:indentLine_enabled
|
if exists("b:indentLine_enabled") && b:indentLine_enabled
|
||||||
syntax clear IndentLine
|
syntax clear IndentLine
|
||||||
endif
|
endif
|
||||||
call s:SetIndentLine()
|
call s:SetIndentLine()
|
||||||
@@ -104,7 +116,7 @@ endfunction
|
|||||||
|
|
||||||
"{{{1 function! s:IndentLinesDisable()
|
"{{{1 function! s:IndentLinesDisable()
|
||||||
function! s:IndentLinesDisable()
|
function! s:IndentLinesDisable()
|
||||||
if b:indentLine_enabled
|
if exists("b:indentLine_enabled") && b:indentLine_enabled
|
||||||
let b:indentLine_enabled = 0
|
let b:indentLine_enabled = 0
|
||||||
syntax clear IndentLine
|
syntax clear IndentLine
|
||||||
endif
|
endif
|
||||||
@@ -112,7 +124,7 @@ endfunction
|
|||||||
|
|
||||||
"{{{1 function! s:IndentLinesToggle()
|
"{{{1 function! s:IndentLinesToggle()
|
||||||
function! s:IndentLinesToggle()
|
function! s:IndentLinesToggle()
|
||||||
if b:indentLine_enabled
|
if exists("b:indentLine_enabled") && b:indentLine_enabled
|
||||||
call s:IndentLinesDisable()
|
call s:IndentLinesDisable()
|
||||||
else
|
else
|
||||||
call s:IndentLinesEnable()
|
call s:IndentLinesEnable()
|
||||||
@@ -143,11 +155,6 @@ function! s:Setup()
|
|||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if ! exists("g:indentLine_noConcealCursor")
|
|
||||||
setlocal concealcursor=inc
|
|
||||||
endif
|
|
||||||
setlocal conceallevel=2
|
|
||||||
|
|
||||||
if &filetype is# ""
|
if &filetype is# ""
|
||||||
call s:InitColor()
|
call s:InitColor()
|
||||||
endif
|
endif
|
||||||
@@ -171,6 +178,7 @@ endfunction
|
|||||||
|
|
||||||
"{{{1 function! s:LeadingSpaceEnable()
|
"{{{1 function! s:LeadingSpaceEnable()
|
||||||
function! s:LeadingSpaceEnable()
|
function! s:LeadingSpaceEnable()
|
||||||
|
call s:SetConcealOption()
|
||||||
if g:indentLine_faster
|
if g:indentLine_faster
|
||||||
echoerr 'LeadingSpace can not be shown when g:indentLine_faster == 1'
|
echoerr 'LeadingSpace can not be shown when g:indentLine_faster == 1'
|
||||||
return
|
return
|
||||||
@@ -181,7 +189,7 @@ endfunction
|
|||||||
|
|
||||||
"{{{1 function! s:LeadingSpaceDisable()
|
"{{{1 function! s:LeadingSpaceDisable()
|
||||||
function! s:LeadingSpaceDisable()
|
function! s:LeadingSpaceDisable()
|
||||||
if b:indentLine_leadingSpaceEnabled
|
if exists("b:indentLine_leadingSpaceEnabled") && b:indentLine_leadingSpaceEnabled
|
||||||
let b:indentLine_leadingSpaceEnabled = 0
|
let b:indentLine_leadingSpaceEnabled = 0
|
||||||
syntax clear IndentLineLeadingSpace
|
syntax clear IndentLineLeadingSpace
|
||||||
endif
|
endif
|
||||||
@@ -189,7 +197,7 @@ endfunction
|
|||||||
|
|
||||||
"{{{1 function! s:LeadingSpaceToggle()
|
"{{{1 function! s:LeadingSpaceToggle()
|
||||||
function! s:LeadingSpaceToggle()
|
function! s:LeadingSpaceToggle()
|
||||||
if b:indentLine_leadingSpaceEnabled
|
if exists("b:indentLine_leadingSpaceEnabled") && b:indentLine_leadingSpaceEnabled
|
||||||
call s:LeadingSpaceDisable()
|
call s:LeadingSpaceDisable()
|
||||||
else
|
else
|
||||||
call s:LeadingSpaceEnable()
|
call s:LeadingSpaceEnable()
|
||||||
|
|||||||
Reference in New Issue
Block a user