TaDaa / vimade

Vimade let's you dim, fade, tint, animate, and customize colors in your windows and buffers
Apache License 2.0
540 stars 10 forks source link

Custom Fade Level per Window/Buffer #55

Closed cseickel closed 3 weeks ago

cseickel commented 3 years ago

First off, great plugin! I saw that this was a feature listed in your readme as a planned future enhancement, but I wanted to add it here so you know that at least one person is looking forward to this one.

The way I'd like to use this is to change the fade level according to how many lines are visible. If the number of lines is one, I want to completely hide the text. I get one line windows when I have maximized another window and I feel like display one line of text is just noise, better to hide it completely.

I'd also like to fade other small windows on sliding scale, so for less than 8 lines it get's progressively darker until the fade level is at 0 for the one line window. I figure the smaller the window is the less focused I am on it so it should demand less attention when I am scanning open windows. This could be implemented with a callback function to get the custom fadelevel of a window, or maybe I could set a local variable with autocmds that vimade can reference.

TaDaa commented 3 years ago

Taking a look at this currently -- I like both your ideas for callback and variables, thinking for callback it will need to be a python a configurable function for performance reasons -- get_fade_level(win, row, col) or something, but seems like a good way to support other customizations

TaDaa commented 3 weeks ago

This is now fully configurable in a couple of ways. This is probably the most direct approach to configure per-window with the default settings now:

For Neovim 0.8+:

::lua::

require('vimade').setup{
  fadelevel = function(style, state)
    if style.win.buf_opts.syntax == 'nerdtree' then
      return 0.8
    else
      return 0.4
    end
  end}

and Vim:

::python::

from vimade import vimade
vimade.setup(
  fadelevel = lambda style, state:
    0.8 if style.win.buf_opts['syntax'] == 'nerdtree'
    else 0.4)

Also included this in the tutorial section of the docs.