From 94acf2947a35d8e0bafc7757e3994b24a7a70895 Mon Sep 17 00:00:00 2001 From: Net Date: Wed, 15 May 2024 12:09:31 -0400 Subject: [PATCH] feat: support horizontal and vertical splits --- README.md | 2 +- lua/copilot/panel.lua | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 48744825..be85f184 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 5b9b9634..bfb55011 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] @@ -539,7 +541,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()