rcarriga / nvim-notify

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

FR: add padding to the side #152

Open chrisgrieser opened 1 year ago

chrisgrieser commented 1 year ago

Using this command:

lua require("notify")("Hello World")

the result currently looks like this

Pasted image 2022-11-08 17 13 21

However, the padding to the top and bottom is larger than to the left; something like this would look more consistent

Pasted image 2022-11-08 17 16 40
rcarriga commented 1 year ago

I don't really want to start editing the messages in the render function, because then we'll have to deal with formatting, wrapping etc. Once anticonceal is merged, this should be possible without needing to do that.

Until then you can do add this to your own config if you're not worried about the above issues:

    render = function(bufnr, notif, highlights)
      local base = require("notify.render.base")
      local namespace = base.namespace()
      local padded_message = vim.tbl_map(function(line)
        return " " .. line
      end, notif.message)
      vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, padded_message)

      vim.api.nvim_buf_set_extmark(bufnr, namespace, 0, 0, {
        hl_group = highlights.icon,
        end_line = #notif.message - 1,
        end_col = #notif.message[#notif.message],
        priority = 50,
      })
    end,
chrisgrieser commented 1 year ago

hmmm, your snippet does work for me, but I also don't think it's worth spending the time debugging when the issue would be tackled via the upstream anticonceal feature anyway. Thank for letting me know!

rcarriga commented 1 year ago

Sure, happy to leave this open for when anticonceal is added :+1:

Reference: https://github.com/neovim/neovim/pull/9496/