File tree 3 files changed +11
-4
lines changed
3 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -263,6 +263,8 @@ return {
263
263
colorscheme = { " habamax" },
264
264
},
265
265
ui = {
266
+ -- a number <1 is a percentage., >1 is a fixed size
267
+ size = { width = 0.8 , height = 0.8 },
266
268
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
267
269
border = " none" ,
268
270
icons = {
Original file line number Diff line number Diff line change @@ -32,6 +32,8 @@ M.defaults = {
32
32
colorscheme = { " habamax" },
33
33
},
34
34
ui = {
35
+ -- a number <1 is a percentage., >1 is a fixed size
36
+ size = { width = 0.8 , height = 0.8 },
35
37
-- The border to use for the UI window. Accepts same border values as |nvim_open_win()|.
36
38
border = " none" ,
37
39
icons = {
Original file line number Diff line number Diff line change @@ -56,16 +56,19 @@ function M.show(mode)
56
56
57
57
local buf = vim .api .nvim_create_buf (false , false )
58
58
M ._buf = buf
59
- local vpad = 6
60
- local hpad = 20
59
+
60
+ local function size (max , value )
61
+ return value > 1 and math.min (value , max ) or math.floor (max * value )
62
+ end
61
63
local opts = {
62
64
relative = " editor" ,
63
65
style = " minimal" ,
64
66
border = Config .options .ui .border ,
65
- width = math.min (vim .o .columns - hpad * 2 , 200 ),
66
- height = math.min (vim .o .lines - vpad * 2 , 70 ),
67
+ width = size (vim .o .columns , Config . options . ui . size . width ),
68
+ height = size (vim .o .lines , Config . options . ui . size . height ),
67
69
noautocmd = true ,
68
70
}
71
+
69
72
opts .row = (vim .o .lines - opts .height ) / 2
70
73
opts .col = (vim .o .columns - opts .width ) / 2
71
74
local win = vim .api .nvim_open_win (buf , true , opts )
You can’t perform that action at this time.
0 commit comments