indent-guides.nvim icon indicating copy to clipboard operation
indent-guides.nvim copied to clipboard

Allows the user to provide their own custom char for indents.

Open hadronized opened this issue 3 years ago • 9 comments

Relates to #6.

hadronized avatar Mar 06 '21 18:03 hadronized

The current code doesn’t seem to work on my side but is a good start. I made the change in the highlighting part so that we can add highlighting without defining a background color (i.e. useful when using indent characters such as .

Something is still missing though as I don’t see the indent anymore. Mind having a look? :)

hadronized avatar Mar 06 '21 18:03 hadronized

I had try this before. you can change color of highlight . maybe you can see the char.

glepnir avatar Mar 07 '21 07:03 glepnir

@glepnir Does this mean that it can be achieved with the current implementation? Is there any setting example?

yamatsum avatar Mar 17 '21 04:03 yamatsum

Nice attempt! So far this only highlights the empty lines:

image

I think the non-virtual highlight is happening on line 177:

local id = vim.fn.matchadd(group,soft_pattern)

Perhaps this one could also be replaced with api.nvim_buf_set_extmark?

My config:

lua require('indent_guides').setup({
            \ indent_char = '▏';
            \ indent_pretty_mode = true;
            \ })

and3rson avatar Mar 17 '21 18:03 and3rson

Here's what I've managed to do:

--- a/lua/indent_guides.lua
+++ b/lua/indent_guides.lua
@@ -174,7 +174,7 @@ local indent_guides_enable = function()
       if column_start ~= nil then
         if new_opts['indent_space_guides'] then
           local soft_pattern = indent_highlight_pattern(new_opts['indent_soft_pattern'],column_start,guide_size)
-          local id = vim.fn.matchadd(group,soft_pattern)
+          local id = vim.fn.matchadd('Conceal',soft_pattern,10,-1,{conceal='▏'})
           table.insert(win_indent_matches[current_winid],id)
         end
         if new_opts['indent_tab_guides'] then

Also,

hi Conceal ctermbg=none ctermfg=white
set conceallevel=1

And ended up having this:

image

Conceal is a hack though (matchadd supports Conceal mode). Would possibly still be better to use virtual text for those highlights.

and3rson avatar Mar 17 '21 18:03 and3rson

Just found this lib - https://github.com/lukas-reineke/indent-blankline.nvim - which works great but still relies on indentLine lib (which is great but uses conceal, which sucks). If you guys do port the functionality in this lib to use virtual text only (and thus leave conceal) it would make this lib much superior to the alternatives. I loved indentLine but hated that it messes up my concealing.

and3rson avatar Mar 17 '21 18:03 and3rson

Just found this lib - https://github.com/lukas-reineke/indent-blankline.nvim - which works great but still relies on indentLine lib (which is great but uses conceal, which sucks). If you guys do port the functionality in this lib to use virtual text only (and thus leave conceal) it would make this lib much superior to the alternatives. I use indentLine but hate that it messes up my concealing.

the lua branch uses virtual text i think

p00f avatar Mar 17 '21 18:03 p00f

yeah indent blankline doesn't depend on conceal anymore or on the indentline plugin and does exactly what this is trying to achieve but you have to take a look a the lua branch, the stuff on master is for compatibility but think that will become default once 0.5 is out

akinsho avatar Mar 17 '21 18:03 akinsho

I know that plugin. but there has some new idea when i have time :)

glepnir avatar Mar 18 '21 09:03 glepnir