nvim-notify.lua 924 B

123456789101112131415161718192021222324252627282930313233343536
  1. -- 悬浮通知
  2. return {
  3. "rcarriga/nvim-notify",
  4. keys = {
  5. {
  6. "<leader>un",
  7. function()
  8. require("notify").dismiss({ silent = true, pending = true })
  9. end,
  10. desc = "Dismiss all Notifications",
  11. },
  12. },
  13. opts = {
  14. timeout = 3000,
  15. max_height = function()
  16. return math.floor(vim.o.lines * 0.75)
  17. end,
  18. max_width = function()
  19. return math.floor(vim.o.columns * 0.75)
  20. end,
  21. on_open = function(win)
  22. vim.api.nvim_win_set_config(win, { zindex = 100 })
  23. end,
  24. },
  25. config = function()
  26. local async = require("plenary.async")
  27. local notify = require("notify").async
  28. local current_time = os.time()
  29. local date_format = "%Y-%m-%d"
  30. local current_time_str = os.date(date_format, current_time)
  31. async.run(function()
  32. -- 自定义 启动 notice
  33. notify("Hollo, 🧑🏻sdaduanbilei today is " .. current_time_str)
  34. end)
  35. end
  36. }