Luigit
repositories / dotfiles

dotfiles

bugabingas dorkfiles

owned by admin

neovim/lua/bugabinga/notify.lua

Raw
local puk = require 'std.puk'
local map = require 'std.map'
local dbg = require 'std.dbg'
local user_command = require 'std.user_command'

puk.defer 'mini.notify' ( function ( notify )
	notify.setup {
		lsp_progress = {
			enable = true,
			duration_last = 444,
		},
		window = {
			winblend = 25,
			config = function ()
				local has_statusline = vim.o.laststatus > 0
				local pad = vim.o.cmdheight + (has_statusline and 1 or 0)
				return { anchor = 'SE', col = vim.o.columns, row = vim.o.lines - pad }
			end,
		},
	}
	local notify_options = {}
	if dbg.get() then
		notify_options = {
			DEBUG = { duration = 300, hl_group = 'DiagnosticHint' },
			TRACE = { duration = 100, hl_group = 'DiagnosticOk' },
		}
	end
	vim.notify = notify.make_notify( notify_options )

	user_command.NotifyHistory 'Show notification history' ( function ()
		notify.show_history()
	end )

	map.normal {
		keys = '<leader>nn',
		command = function () notify.show_history() end,
		description = 'show notification history',
		category = 'notify',
	}
end )