From 79c518a9d735935779df97f1b96897966b660a2a Mon Sep 17 00:00:00 2001 From: amrbashir Date: Sat, 28 Jan 2023 00:42:39 +0200 Subject: [PATCH] feat: support `top` for position closes #5 --- README.md | 2 +- lua/docs-view.lua | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 5437964..9339278 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ EOF ## Usage -Use `:DocsViewToggle` to open/close the docs view side panel +Use `:DocsViewToggle` to open/close the docs view panel ## LICENSE diff --git a/lua/docs-view.lua b/lua/docs-view.lua index a096a71..2c81c86 100644 --- a/lua/docs-view.lua +++ b/lua/docs-view.lua @@ -17,6 +17,9 @@ local function toggle() if cfg.position == "bottom" then vim.api.nvim_command("bel new") width = vim.api.nvim_win_get_width(prev_win) + elseif cfg.position == "top" then + vim.api.nvim_command("top new") + width = vim.api.nvim_win_get_height(prev_win) elseif cfg.position == "left" then vim.api.nvim_command("topleft vnew") height = vim.api.nvim_win_get_height(prev_win)