summaryrefslogtreecommitdiffstats
path: root/after/plugin/notify.lua
blob: 5d27a7c7591d719fcf0c511c57dfb8fed96fbc5b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
local status_ok, notify = pcall(require, "notify")
if not status_ok then
	return
end

notify.setup {
  timeout = 3000,
  minimum_width = 35,
  icons = {
    DEBUG = "B",
    ERROR = "x",
    INFO = "i",
    TRACE = "t",
    WARN = "!"
  },

  max_height = function() return math.floor(vim.o.lines * 0.75) end,
  max_width = function() return math.floor(vim.o.columns * 0.5) end,
  on_open = function(win, record)
    if record.title[1] == '' then record.title[1] = 'Unkown' end
    vim.api.nvim_win_set_config(win, {
      title = {
        { ' '..record.title[1]..' ', 'Notify'..record.level..'Title' }
      },
      title_pos = 'center',
      border = 'single'
    })
  end,
  render = function(bufnr, notif)
    vim.api.nvim_buf_set_lines(bufnr, 0, -1, false, notif.message)
  end,
}