rcarriga / nvim-notify

A fancy, configurable, notification manager for NeoVim
MIT License
3k stars 80 forks source link

[FEATURE REQUEST]: limit max number of notifications being shown at the same time #120

Closed mitinarseny closed 1 year ago

mitinarseny commented 2 years ago

Thanks again for this plugin!

It would be cool if there is a setting, which allows you to set the limit for the number of notifications being shown at the same time. If real number of currently present notifications exceeds this limit, then the last (the nearest to the bottom of window) notification should say something like "3 more...". When one of the present notifications is timed out and vanished, then the first from these "3 more..." is shown and etc... Or if you have any alternative ideas - it's up for discussion! ;)

rcarriga commented 2 years ago

You can limit the number of notifications with custom stages like so

  local stages = require("notify.stages").fade_in_slide_out

  require("notify").setup({
    stages = vim.list_extend({
      function(state)
        if #state.open_windows >= 3 then
          return nil
        end
        return stages[1](state)
      end,
    }, vim.list_slice(stages, 2, #stages)),
  })

then the last (the nearest to the bottom of window) notification should say something like "3 more...".

I don't think this would be worth doing, editing a notification window depending on the state of the windows would be complex and introduce coupling of currently quite separate parts of the code.

Instead nvim-notify could expose the number of notifications pending which could be used in a statusline or something