From d660438a3b6666f61da5cf1d9df55f5075fd8550 Mon Sep 17 00:00:00 2001 From: aspeddro Date: Wed, 29 Sep 2021 20:16:44 -0300 Subject: [PATCH] fullscreen option --- README.md | 4 +++- lua/slides.lua | 10 +++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c0689f8..385c377 100644 --- a/README.md +++ b/README.md @@ -25,8 +25,10 @@ use { ## Configuration ```lua +-- default config require'slides'.setup{ - bin = 'slides' -- default config, path to binary + bin = 'slides' -- path to binary + fullscreen = true -- open in fullscreen } ``` diff --git a/lua/slides.lua b/lua/slides.lua index c9a0bbb..0646049 100644 --- a/lua/slides.lua +++ b/lua/slides.lua @@ -5,7 +5,8 @@ local state = { } local config = { - bin = 'slides' + bin = 'slides', + fullscreen = true } function M.close() @@ -21,11 +22,14 @@ function M.setup(user_config) end function M.show(file) + + local window = vim.api.nvim_get_current_win() + local opts = { style = "minimal", relative = "editor", - width = vim.api.nvim_get_option("columns"), - height = vim.api.nvim_get_option("lines"), + width = config.fullscreen and vim.api.nvim_get_option("columns") or vim.api.nvim_win_get_width(window), + height = config.fullscreen and vim.api.nvim_get_option("lines") or vim.api.nvim_win_get_height(window), row = 1, col = 1, border = "shadow",