lukas-reineke / indent-blankline.nvim

Indent guides for Neovim
MIT License
4.07k stars 102 forks source link

Window-local Option for Indentation Guides in IBL #834

Closed tummetott closed 7 months ago

tummetott commented 7 months ago

Problem

Hello,

It would be great if IBL could support a window-local option to enable or disable indentation guides. I'm aware that there is a buffer-local option:

require "ibl".setup_buffer(0, { enabled = false })

However, a window-local option would allow for much better and more fine-grained customization. Since windows are viewpoints onto buffers, there are use cases where you might want to have indentation guides disabled for one window but not disabled for another one showing the same buffer. Similar built-in Vim options like list or number are also all window-local options instead of buffer-local options.

For example, the plugin diffview.nvim creates a new tab for diff views. I can jump back and forth to the diffview window by switching tabs. I generally want my diffviews to not show indentation guides, but I want all other windows to show them. Currently, it is possible to turn off indentation guides in diff windows by registering an autocmd on events like OptionSet diff, BufWinEnter, or similar. However, when turning off indentation guides for buffers involved in a diff, it turns off indentation guides for all windows with that buffer, even windows that are not in diff mode.

Expected behavior

Having a window local setting to enable or disable indentation guides

lukas-reineke commented 7 months ago

I agree it would be nice, but it's not currently possible. IBL works with ext marks, and they are local to the buffer.