vim-indent-guides
vim-indent-guides copied to clipboard
Unicode chars for drawing the line?
Would it be possible to use the unicode characters for drawing a line (aka skinning guides) instead of a whole character row? It'd be much more pleasing to the eye and the coloring would be easier to deal with...
I'm thinking of Unicode character U+2502 "│"
Ciao!
Actually you can archive it with vim option set listchars+=tab:│\ , and set noexpandtab. But this has a lot of limitations. It need you to use literal Tab.
Of course, if this plugin can support another style indent will be awesome.
I would love to see "│" in indentation that would work with space characters.
@sergey-vlasov I guess it is impossible to draw | when space indentation settings.
:exe 'syn match Guides ''%(^%( {'.&sw.'})*)@<= '' conceal cchar=|' :setl conceallevel=2 concealcursor=nc
Indentation made with spaces, with indent-guides plugin disabled:

looks good. I'm wrong. @sergey-vlasov . Now. I want this feature too now. :smile:
Using a syntax match could interfere with syntax highlighting. But that is the only way to use any sort of character to mark indents.
This plugin has you covered: https://github.com/Yggdroot/indentLine
Not sure if it's worth replicating this functionality when another plugin already has it covered :)
@nathanaelkane You probably could have phrased it more diplomatically. I'm liking the look of indentLine so far.
I wasn't trying to dismiss your ticket, I was merely suggesting an alternative plugin which solves your issue.
Now that I know how, I will try to implement this feature in future, but am more than happy to accept pull-requests in the meantime.
@nathanaelkane +1 for this feature. I am looking forward to see it. Thanks for the awesome plugin, btw.
The issue is that indentLine plugin does not handle tab-based indentations. I do not want to use listchars method because then it will show up in non-indentation tabs too.
Yggdroot/indentLine uses conceal and needs increasing conceallevel which leads to undesirable side effects for rendering tex, markdown and some other stuff (e.g. it leads to hiding star symbols around emphasized text in markdown).
However there is a way to support thin lines using vim-indent-guides plugin and listchar, even for spaces. Basically, the idea is to set the symbol for the space to the desirable char but to make its foreground color the same as the background color by default:
set listchars=space:│
" I use white(-ish) background, so I use 15 here
hi SpecialKey ctermfg=15
Then vim-indent-guides is configured to change the foreground color instead of the background:
let g:indent_guides_guide_size = 1
let g:indent_guides_auto_colors = 0
hi IndentGuidesOdd ctermbg=NONE
hi IndentGuidesEven ctermbg=NONE
hi IndentGuidesOdd ctermfg=grey
hi IndentGuidesEven ctermfg=grey
Of course, this trick has its own side effects, like ugliness in visual mode, and other special chars, like tabs and trailing whitespaces, not being shown.

Look into https://github.com/yuntan/neovim-indent-guides as a way to add this feature for NeoVIM.
I don't think we'll be adding this for VIM, but if it can be isolated in an easy to maintain way I would consider a PR that adds the alternative display using virtual text (NeoVIM only and not subject to the wierdnesses/drawbacks as above) and facilitate it getting added. cc @yuntan if you are interested in contributing that back upstream, or of course anybody else that wants to adjust that fork for the purpose.