From 0fe1aaa9ff6de521e2abd535d569262475d243da Mon Sep 17 00:00:00 2001 From: Net Date: Wed, 11 Dec 2024 14:35:05 -0500 Subject: [PATCH] feat: support horizontal and vertical splits (#289) --- README.md | 2 +- lua/copilot/panel.lua | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3932d1b..c2f2ff6 100644 --- a/README.md +++ b/README.md @@ -57,7 +57,7 @@ require('copilot').setup({ open = "" }, layout = { - position = "bottom", -- | top | left | right + position = "bottom", -- | top | left | right | horizontal | vertical ratio = 0.4 }, }, diff --git a/lua/copilot/panel.lua b/lua/copilot/panel.lua index ace34eb..17f5bba 100644 --- a/lua/copilot/panel.lua +++ b/lua/copilot/panel.lua @@ -331,6 +331,8 @@ function panel:ensure_winid() right = { cmd_prefix = "vertical botright ", winsize_fn = get_width }, bottom = { cmd_prefix = "botright ", winsize_fn = get_height }, left = { cmd_prefix = "vertical topleft ", winsize_fn = get_width }, + horizontal = { cmd_prefix = "horizontal ", winsize_fn = get_height }, + vertical = { cmd_prefix = "vertical ", winsize_fn = get_width }, } local split_info = split_map[position] @@ -541,7 +543,7 @@ function mod.refresh() end ---@param layout {position: string, ratio: number} ----position: (optional) 'bottom' | 'top' | 'left' | 'right' +---position: (optional) 'bottom' | 'top' | 'left' | 'right' | 'horizontal' | 'vertical' ---ratio: (optional) between 0 and 1 function mod.open(layout) local client = c.get()