vim-indent-guides icon indicating copy to clipboard operation
vim-indent-guides copied to clipboard

Unicode chars for drawing the line?

Open docwhat opened this issue 13 years ago • 14 comments
trafficstars

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!

docwhat avatar Oct 13 '12 02:10 docwhat

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.

stardiviner avatar Oct 13 '12 02:10 stardiviner

Of course, if this plugin can support another style indent will be awesome.

stardiviner avatar Oct 13 '12 02:10 stardiviner

I would love to see "│" in indentation that would work with space characters.

noscript avatar Oct 15 '12 12:10 noscript

@sergey-vlasov I guess it is impossible to draw | when space indentation settings.

stardiviner avatar Oct 15 '12 12:10 stardiviner

:exe 'syn match Guides ''%(^%( {'.&sw.'})*)@<= '' conceal cchar=|' :setl conceallevel=2 concealcursor=nc

Indentation made with spaces, with indent-guides plugin disabled: screenshot

noscript avatar Oct 15 '12 13:10 noscript

looks good. I'm wrong. @sergey-vlasov . Now. I want this feature too now. :smile:

stardiviner avatar Oct 15 '12 13:10 stardiviner

Using a syntax match could interfere with syntax highlighting. But that is the only way to use any sort of character to mark indents.

graywh avatar Oct 15 '12 15:10 graywh

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 avatar Jan 30 '13 22:01 nathanaelkane

@nathanaelkane You probably could have phrased it more diplomatically. I'm liking the look of indentLine so far.

docwhat avatar Jan 31 '13 01:01 docwhat

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 avatar Jan 31 '13 02:01 nathanaelkane

@nathanaelkane +1 for this feature. I am looking forward to see it. Thanks for the awesome plugin, btw.

dalguji avatar Oct 28 '14 05:10 dalguji

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.

petejkim avatar Feb 09 '15 23:02 petejkim

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. screenshot_2018-11-25_13-40-41

sergei-grechanik avatar Nov 25 '18 10:11 sergei-grechanik

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.

alerque avatar Feb 21 '23 18:02 alerque