Skip to content

Commit

Permalink
feat: support horizontal and vertical splits (#289)
Browse files Browse the repository at this point in the history
  • Loading branch information
net authored Dec 11, 2024
1 parent 7593549 commit 0fe1aaa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ require('copilot').setup({
open = "<M-CR>"
},
layout = {
position = "bottom", -- | top | left | right
position = "bottom", -- | top | left | right | horizontal | vertical
ratio = 0.4
},
},
Expand Down
4 changes: 3 additions & 1 deletion lua/copilot/panel.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit 0fe1aaa

Please sign in to comment.