Added preview width and relative size

Signed-off-by: Freyskeyd <simon.paitrault@gmail.com>
This commit is contained in:
Freyskeyd
2022-04-22 15:59:53 +02:00
parent 15ae99c273
commit 7092ee1728
2 changed files with 21 additions and 3 deletions

View File

@@ -9,6 +9,9 @@ M.defaults = {
border = 'single',
relative_width = true,
width = 25,
preview_min_width = 100,
preview_width = 50,
relative_preview_width = true,
auto_close = false,
auto_preview = true,
show_numbers = false,
@@ -80,6 +83,20 @@ function M.get_window_width()
end
end
function M.get_preview_width()
if M.options.relative_preview_width then
local relative_width = math.ceil(vim.o.columns * (M.options.preview_width / 100))
if relative_width < M.options.preview_min_width then
return M.options.preview_min_width
else
return relative_width
end
else
return M.options.preview_width
end
end
function M.get_split_command()
if M.options.position == 'left' then
return 'topleft vs'