@@ -198,6 +198,20 @@ function! s:SetUndoDir()
198
198
endif
199
199
endfunction
200
200
201
+ function ! s: SetIndentGuideHighlights (user_initiated)
202
+ if g: workspace_indentguides && index (g: workspace_indentguides_ignore , &filetype ) == -1
203
+ if ! a: user_initiated
204
+ silent ! syntax clear IndentGuideSpaces
205
+ silent ! syntax clear IndentGuideDraw
206
+ endif
207
+ execute " highlight Conceal ctermfg=238 ctermbg=NONE guifg=Grey27 guibg=NONE"
208
+ execute " highlight SpecialKey ctermfg=238 ctermbg=NONE guifg=Grey27 guibg=NONE"
209
+ execute ' syntax match IndentGuideSpaces /^\ \+/ containedin=ALL contains=IndentGuideDraw keepend'
210
+ execute printf (' syntax match IndentGuideDraw /^\zs\ \ze\ \{%i}/ contained conceal cchar=┆' , &l: shiftwidth - 1 )
211
+ execute printf (' syntax match IndentGuideDraw /\ \{%i}\zs \ze/ contained conceal cchar=┆' , &l: shiftwidth - 1 )
212
+ endif
213
+ endfunction
214
+
201
215
function ! s: ToggleIndentGuides (user_initiated)
202
216
let b: toggle_indentguides = get (b: , ' toggle_indentguides' , 1 )
203
217
@@ -208,10 +222,7 @@ function! s:ToggleIndentGuides(user_initiated)
208
222
endif
209
223
210
224
if b: toggle_indentguides
211
- execute " highlight Conceal ctermfg=238 ctermbg=NONE guifg=Grey27 guibg=NONE"
212
- execute " highlight SpecialKey ctermfg=238 ctermbg=NONE guifg=Grey27 guibg=NONE"
213
- execute ' syntax match IndentGuideSpaces /^\ \+/ containedin=ALL contains=IndentGuideDraw keepend'
214
- execute printf (' syntax match IndentGuideDraw /\(^\|\ \)\{%i}\zs / contained conceal cchar=┆' , &l: shiftwidth - 1 )
225
+ call s: SetIndentGuideHighlights (a: user_initiated )
215
226
216
227
" TODO-TK: local and global listchars are the same, and s: variables are failing (??)
217
228
let g: original_listchars = get (g: , ' original_listchars' , &g: listchars )
@@ -239,6 +250,7 @@ function! s:PostLoadCleanup()
239
250
endfunction
240
251
241
252
augroup Workspace
253
+ au ! BufRead ,ColorScheme * call s: SetIndentGuideHighlights (0 )
242
254
au ! BufWinEnter * call s: ToggleIndentGuides (0 )
243
255
au ! VimEnter * nested call s: LoadWorkspace ()
244
256
au ! VimLeave * call s: MakeWorkspace (0 )
0 commit comments