Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/airblade/vim-interdental
Indent guides that span empty lines
https://github.com/airblade/vim-interdental
indentation vim vim-plugin
Last synced: 25 days ago
JSON representation
Indent guides that span empty lines
- Host: GitHub
- URL: https://github.com/airblade/vim-interdental
- Owner: airblade
- License: mit
- Created: 2023-08-18T15:53:41.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-10-05T13:14:04.000Z (about 1 year ago)
- Last Synced: 2024-10-05T00:40:56.284Z (about 2 months ago)
- Topics: indentation, vim, vim-plugin
- Language: Vim Script
- Homepage:
- Size: 655 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.markdown
Awesome Lists containing this project
README
# vim-interdental
Indent guides that span empty lines.
### Quick start
1. Set `g:leadmultispace` to your indent guide characters – without escaping spaces. For example:
```vim
let g:leadmultispace = ' ⋮ · ⋮ · ⋮ · ⋮ · ⋮ · ⋮ · ⋮ · ⋮'
```(Don't set `'listchars+=leadmultispace:...'`. The plugin manages it for you.)
2. Set up a map to toggle your indent guides. For example:
```vim
nmap ti (InterdentalToggle)
```3. Set the filetypes for which you want indent guides by default. For example:
```vim
autocmd FileType ruby,html call interdental#toggle(1)
```### Description
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.
```vim
setlocal listchars+=leadmultispace:\ \ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮
```And here is what it looks like:
![Intermittent indent guides](./before.png?raw=true)
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.
```diff
- setlocal listchars+=leadmultispace:\ \ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮\ ·\ ⋮
+ let g:leadmultispace = ' ⋮ · ⋮ · ⋮ · ⋮ · ⋮ · ⋮ · ⋮ · ⋮'
```Behold the unbroken indent guides!
![Continuous indent guides](./after.png?raw=true)
### Intellectual property
Copyright Andrew Stewart, AirBlade Software Ltd. Released under the MIT licence.