Indent guides that span empty lines.
-
Set
g:leadmultispace
to your indent guide characters – without escaping spaces. For example:let g:leadmultispace = ' ⋮ · ⋮ · ⋮ · ⋮ · ⋮ · ⋮ · ⋮ · ⋮'
(Don't set
'listchars+=leadmultispace:...'
. The plugin manages it for you.) -
Set up a map to toggle your indent guides. For example:
nmap <Leader>ti <Plug>(InterdentalToggle)
-
Set the filetypes for which you want indent guides by default. For example:
autocmd FileType ruby,html call interdental#toggle(1)
The built-in option 'lcs-leadmultispace'
is perfect for indent guides. It is one or more characters that are shown cyclically when a line has leading spaces.
For example, I like:
- indent guides every two characters;
- alternating two different characters to help distinguish the guides;
- not having a guide in column 1.
This is how to set it up. Note that spaces have to be escaped.
setlocal listchars+=leadmultispace:\ \ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮
And here is what it looks like:
The problem is that empty lines don't have any leading spaces, so they don't get indent guides.
This plugin uses virtual text to display the indent guides on empty lines.
- setlocal listchars+=leadmultispace:\ \ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮
+ let g:leadmultispace = ' ⋮ · ⋮ · ⋮ · ⋮ · ⋮ · ⋮ · ⋮ · ⋮'
Behold the unbroken indent guides!
Copyright Andrew Stewart, AirBlade Software Ltd. Released under the MIT licence.