Skip to content

Commit

Permalink
fix(telescope): pass config to telescope
Browse files Browse the repository at this point in the history
See #102
  • Loading branch information
rcarriga committed Jun 5, 2022
1 parent 1312688 commit 1b851fb
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 4 additions & 0 deletions lua/notify/init.lua
Expand Up @@ -34,6 +34,10 @@ function notify.setup(user_config)
vim.cmd([[command! Notifications :lua require("notify")._print_history()<CR>]])
end

function notify._config()
return config.setup(global_config)
end

---@class notify.Options @Options for an individual notification
---@field title string
---@field icon string
Expand Down
9 changes: 7 additions & 2 deletions lua/telescope/_extensions/notify.lua
Expand Up @@ -7,6 +7,7 @@ local actions = require("telescope.actions")
local action_state = require("telescope.actions.state")
local previewers = require("telescope.previewers")
local entry_display = require("telescope.pickers.entry_display")
local notify = require("notify")

local widths = {
time = 8,
Expand Down Expand Up @@ -64,7 +65,7 @@ local telescope_notifications = function(opts)
local selection = action_state.get_selected_entry()
local notification = selection.value
local buf = vim.api.nvim_create_buf(false, true)
local notif_buf = NotificationBuf(buf, notification)
local notif_buf = NotificationBuf(buf, notification, { config = notify._config() })
notif_buf:render()

local height = notif_buf:height()
Expand All @@ -90,7 +91,11 @@ local telescope_notifications = function(opts)
define_preview = function(self, entry, status)
local notification = entry.value
local max_width = vim.api.nvim_win_get_config(status.preview_win).width
local notif_buf = NotificationBuf(self.state.bufnr, notification, { max_width = max_width })
local notif_buf = NotificationBuf(
self.state.bufnr,
notification,
{ max_width = max_width, config = notify._config() }
)
notif_buf:render()
end,
}),
Expand Down

0 comments on commit 1b851fb

Please sign in to comment.