Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hide indent guides in visual mode #132

Open
Unoqwy opened this issue Jun 28, 2021 · 9 comments
Open

Hide indent guides in visual mode #132

Unoqwy opened this issue Jun 28, 2021 · 9 comments

Comments

@Unoqwy
Copy link

Unoqwy commented Jun 28, 2021

Hey! I've just switched from indent-guides.nvim to this plugin and one of the first thing I notice is the indent guides are displayed even in visual mode. Is there any way to hide them (lua branch)?

@lukas-reineke
Copy link
Owner

No it's not possible.

Neovim has virt_text_hide which should allow this, but it's currently not working neovim/neovim#14050 (comment)

@Unoqwy
Copy link
Author

Unoqwy commented Jun 29, 2021

Hm, virt_text_hide=true works in the neovim test suite, but only because col is always greater than 0. The reason why it doesn't work here is because col is 0 (if set to 1 it does, but of course everything is shifted and empty lines don't render virttext).
Now why is this happening? No clue. I couldn't find any mention of column 0 affecting virttext options in the neovim issues so either they don't know it or I have failed at searching.

@lukas-reineke
Copy link
Owner

You're right, it's only broken for col 0
You should comment that in the issue above, or make a new one

@Unoqwy
Copy link
Author

Unoqwy commented Jun 30, 2021

Yeah, I created a new issue because it 's not really related to scrolling. See neovim/neovim#14929.
Also, I noticed you @mentioned bfredl in your issue after creating it, should we do the same here?

@lukas-reineke
Copy link
Owner

bfredl wrote all of this virtual text code. He knows best how to fix it.
Up to you if you want to tag him, he'll probably see it anyway.

@FelipeLema
Copy link

FelipeLema commented Sep 29, 2023

hey, everyone... I'm seeing this problem with block-visual (:help CTRL-V) with v3 and current options:

{
    indent = {
      char = '',
      highlight = {""}
    },
    scope = {show_start = false}
}

@FelipeLema
Copy link

ended up using the following snippet to turn on/off indent-blanklines when exiting/entering visual mode

local saca_de_enmedio_a_indent_blankline = vim.api.nvim_create_augroup("saca_de_enmedio_a_indent_blankline",
  {clear = true})
vim.api.nvim_create_autocmd("ModeChanged",
  {
    group = saca_de_enmedio_a_indent_blankline,
    pattern = "[vV\x16]*:*", -- visual → cualquier cosa
    command = "IBLEnable",
    desc = "Habilita indent-blanklines al salir de modo visual"
  })
vim.api.nvim_create_autocmd("ModeChanged",
  {
    group = saca_de_enmedio_a_indent_blankline,
    pattern = "*:[vV\x16]*", -- cualquier cosa → visual
    command = "IBLDisable",
    desc = "Deshabilita indent-blanklines al salir de modo visual"
  })

@akoerner1
Copy link

This is a related question. How can I configure the plugin to never hide indent guides?

@ArjunSahlot
Copy link

ArjunSahlot commented Jan 16, 2024

ended up using the following snippet to turn on/off indent-blanklines when exiting/entering visual mode

local saca_de_enmedio_a_indent_blankline = vim.api.nvim_create_augroup("saca_de_enmedio_a_indent_blankline",
  {clear = true})
vim.api.nvim_create_autocmd("ModeChanged",
  {
    group = saca_de_enmedio_a_indent_blankline,
    pattern = "[vV\x16]*:*", -- visual → cualquier cosa
    command = "IBLEnable",
    desc = "Habilita indent-blanklines al salir de modo visual"
  })
vim.api.nvim_create_autocmd("ModeChanged",
  {
    group = saca_de_enmedio_a_indent_blankline,
    pattern = "*:[vV\x16]*", -- cualquier cosa → visual
    command = "IBLDisable",
    desc = "Deshabilita indent-blanklines al salir de modo visual"
  })

This is perfect!

Here's an English version I made for myself 😅:

local indent_blankline_augroup = vim.api.nvim_create_augroup("indent_blankline_augroup", {clear = true})
vim.api.nvim_create_autocmd("ModeChanged", {
    group = indent_blankline_augroup,
    pattern = "[vV\x16]*:*",
    command = "IBLEnable",
    desc = "Enable indent-blankline when exiting visual mode"
})

vim.api.nvim_create_autocmd("ModeChanged", {
    group = indent_blankline_augroup,
    pattern = "*:[vV\x16]*",
    command = "IBLDisable",
    desc = "Disable indent-blankline when exiting visual mode"
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants