mirror of https://github.com/folke/lazy.nvim.git
feat(ui): make the windoww size configurable. Fixes #34
This commit is contained in:
parent
52984419ff
commit
941df31a41
|
@ -263,6 +263,8 @@ return {
|
|||
colorscheme = { "habamax" },
|
||||
},
|
||||
ui = {
|
||||
-- a number <1 is a percentage., >1 is a fixed size
|
||||
size = { width = 0.8, height = 0.8 },
|
||||
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
|
||||
border = "none",
|
||||
icons = {
|
||||
|
|
|
@ -32,6 +32,8 @@ M.defaults = {
|
|||
colorscheme = { "habamax" },
|
||||
},
|
||||
ui = {
|
||||
-- a number <1 is a percentage., >1 is a fixed size
|
||||
size = { width = 0.8, height = 0.8 },
|
||||
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
|
||||
border = "none",
|
||||
icons = {
|
||||
|
|
|
@ -56,16 +56,19 @@ function M.show(mode)
|
|||
|
||||
local buf = vim.api.nvim_create_buf(false, false)
|
||||
M._buf = buf
|
||||
local vpad = 6
|
||||
local hpad = 20
|
||||
|
||||
local function size(max, value)
|
||||
return value > 1 and math.min(value, max) or math.floor(max * value)
|
||||
end
|
||||
local opts = {
|
||||
relative = "editor",
|
||||
style = "minimal",
|
||||
border = Config.options.ui.border,
|
||||
width = math.min(vim.o.columns - hpad * 2, 200),
|
||||
height = math.min(vim.o.lines - vpad * 2, 70),
|
||||
width = size(vim.o.columns, Config.options.ui.size.width),
|
||||
height = size(vim.o.lines, Config.options.ui.size.height),
|
||||
noautocmd = true,
|
||||
}
|
||||
|
||||
opts.row = (vim.o.lines - opts.height) / 2
|
||||
opts.col = (vim.o.columns - opts.width) / 2
|
||||
local win = vim.api.nvim_open_win(buf, true, opts)
|
||||
|
|
Loading…
Reference in New Issue