rcarriga / nvim-notify

A fancy, configurable, notification manager for NeoVim
MIT License
2.91k stars 74 forks source link

[feat]: :Notifications command to open history in a split #229

Closed niksingh710 closed 7 months ago

niksingh710 commented 8 months ago

is it possible to open a specific notification from history to a split window it will make them checking error logs much easier.

rcarriga commented 7 months ago

You can use the API to get the notifications to show anyway that you like :smile:

local notify = require("notify")

local lines = {}
for _, notif in ipairs(notify.history()) do
  table.insert(
    lines,
    ("%s %s: %s"):format(notif.title[1], notif.title[2], table.concat(notif.message, "\n"))
  )
end
local buf = vim.api.nvim_create_buf(false, true)
vim.api.nvim_set_option_value("bufhidden", "wipe", { buf = buf })
vim.api.nvim_buf_set_lines(buf, 0, -1, false, lines)
vim.cmd("vsplit")
vim.api.nvim_win_set_buf(0, buf)

I won't be adding this to nvim-notify as there are too many possible configurations and it's easy for people to implement as they want