Created

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Vim Indentation Guides Emulation

View gist:734422
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
nmap <silent> <leader><bar> :call ToggleIndentGuidesTabs()<cr>
nmap <silent> <leader><bslash> :call ToggleIndentGuidesSpaces()<cr>
 
function! ToggleIndentGuidesTabs()
if exists('b:iguides_tabs')
setlocal nolist
let &l:listchars = b:iguides_tabs
unlet b:iguides_tabs
else
let b:iguides_tabs = &l:listchars
setlocal listchars=tab:\ "protect the space
setlocal list
endif
endfunction
 
function! ToggleIndentGuidesSpaces()
if exists('b:iguides_spaces')
call matchdelete(b:iguides_spaces)
unlet b:iguides_spaces
else
let pos = range(1, &l:textwidth, &l:shiftwidth)
call map(pos, '"\\%" . v:val . "v"')
let pat = '\%(\_^\s*\)\@<=\%(' . join(pos, '\|') . '\)\s'
let b:iguides_spaces = matchadd('CursorLine', pat)
endif
endfunction

Could you show a screenshot about it?

Owner

@zhouzhuojie: Here are two: one for tabs and one for spaces.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.