AckslD/messages.nvim

mac OS Big sur has a issue "attempt to call global 'clip_val' (a nil value) "

Closed this issue · 1 comments

According to the manual, this issue is reported after setting.
Error executing Lua callback: /Users/****/.config/nvim/lua/co re/messages.lua:24: attempt to call global 'clip_val' (a nil value) stack traceback: /Users/****/.config/nvim/lua/core/messages.lua:24: in function 'buffer_opts' ...ite/pack/packer/start/messages.nvim/lua/messages/api.lua:8: in function 'open_float' ...ite/pack/packer/start/messages.nvim/lua/messages/api.lua:23: in function 'capture_cmd' ...te/pack/packer/start/messages.nvim/lua/messages/init.lua:12: in function <...te/pack/packer/start/messages.nvim/lua/messages/init.lua:11>

This is my set

`local message_status_ok, messages = pcall(require, "messages")
if not message_status_ok then
return
end

messages.setup({
command_name = 'Messages',
-- should prepare a new buffer and return the winid
-- by default opens a floating window
-- provide a different callback to change this behaviour
-- @param opts: the return value from float_opts
prepare_buffer = function(opts)
local buf = vim.api.nvim_create_buf(false, true)
return vim.api.nvim_open_win(buf, true, opts)
end,
-- should return options passed to prepare_buffer
-- @param lines: a list of the lines of text
buffer_opts = function(lines)
local gheight = vim.api.nvim_list_uis()[1].height
local gwidth = vim.api.nvim_list_uis()[1].width
return {
relative = 'editor',
width = gwidth - 2,
height = clip_val(1, #lines, gheight * 0.5),
anchor = 'SW',
row = gheight - 1,
col = 0,
style = 'minimal',
border = 'rounded',
zindex = 1,
}
end,
})`

That's in your config, you can require the clip_val function from messages.utils if you want to use it in your config.