rcarriga / nvim-notify

A fancy, configurable, notification manager for NeoVim
MIT License
2.97k stars 78 forks source link

feat: allow user to provide border option #182

Closed mikesmithgh closed 1 year ago

mikesmithgh commented 1 year ago

I am currently using the compact view and would like to disable borders. I achieved this by modiying https://github.com/rcarriga/nvim-notify/blob/master/lua/notify/stages/fade_in_slide_out.lua#L18 to border = "none", Here a screenshot: Screenshot 2023-03-01 at 11 23 47 PM

This is a feature request to let the user configure border options. Thanks!

rcarriga commented 1 year ago

I'd rather avoid configs like this because they require making identical changes to each of the stages. However the stages are designed to be easily customised. I've actually been using something very similar myself

  local stages = require("notify.stages.slide")("top_down")
  local notify = require("notify")

  notify.setup({
    render = "compact",
    stages = {
      function(...)
        local opts = stages[1](...)
        if opts then
          opts.border = "none"
        end
        return opts
      end,
      unpack(stages, 2),
    },
    ...
  })
mikesmithgh commented 1 year ago

This worked perfectly. Thanks! Below is the config I went with.

return {
  'rcarriga/nvim-notify',
  enabled = true,
  config = function()
    local stages = require("notify.stages.slide")("top_down")
    local notify = require("notify")

    notify.setup({
      render = "compact",
      stages = {
        function(...)
          local opts = stages[1](...)
          if opts then
            opts.border = "none"
            opts.row = opts.row + 1
          end
          return opts
        end,
        unpack(stages, 2),
      },
      timeout = 2000,
    })
  end
}

https://user-images.githubusercontent.com/10135646/222729521-079b9c54-6e7a-437f-9d99-91dfa1d5c93b.mov

Learned about variable arguments in Lua too 🙂