plugins/toggleterm: allow lua functions in float_opts keys which support them

This commit is contained in:
Michael Thomas 2024-06-13 09:04:13 +02:00 committed by Gaétan Lepage
parent 80c03843e7
commit db93efffdb
2 changed files with 23 additions and 5 deletions

View file

@ -228,13 +228,27 @@ helpers.neovim-plugin.mkNeovimPlugin config {
The 'curved' border is a custom border type not natively supported but implemented in this plugin. The 'curved' border is a custom border type not natively supported but implemented in this plugin.
''; '';
width = helpers.mkNullOrOption types.ints.unsigned ""; width = helpers.defaultNullOpts.mkStrLuaFnOr types.ints.unsigned null ''
Width of the floating terminal. Like `size`, `width` can be a number or
function which is passed the current terminal.
'';
height = helpers.mkNullOrOption types.ints.unsigned ""; height = helpers.defaultNullOpts.mkStrLuaFnOr types.ints.unsigned null ''
Height of the floating terminal. Like `size`, `height` can be a number
or function which is passed the current terminal.
'';
row = helpers.mkNullOrOption types.ints.unsigned ""; row = helpers.defaultNullOpts.mkStrLuaFnOr types.ints.unsigned null ''
Start row of the floating terminal. Defaults to the center of the
screen. Like `size`, `row` can be a number or function which is passed
the current terminal.
'';
col = helpers.mkNullOrOption types.ints.unsigned ""; col = helpers.defaultNullOpts.mkStrLuaFnOr types.ints.unsigned null ''
Start column of the floating terminal. Defaults to the center of the
screen. Like `size`, `col` can be a number or function which is passed
the current terminal.
'';
winblend = helpers.defaultNullOpts.mkUnsignedInt 0 ""; winblend = helpers.defaultNullOpts.mkUnsignedInt 0 "";

View file

@ -60,7 +60,11 @@
auto_scroll = false; auto_scroll = false;
float_opts = { float_opts = {
border = "double"; border = "double";
width = 30; width = ''
function()
return math.ceil(vim.o.columns * 0.8)
end
'';
height = 30; height = 30;
winblend = 5; winblend = 5;
zindex = 20; zindex = 20;