Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -289,8 +289,8 @@ local defaults = {
-- Options used when layout is "left"|"bottom"|"top"|"right"
---@type vim.api.keyset.win_config
split = {
width = 80,
height = 20,
width = 80, -- set to 0 for default split with
height = 20, -- set to 0 for default split height
},
--- CLI Tool Keymaps (default mode is `t`)
---@type table<string, sidekick.cli.Keymap|false>
Expand Down
7 changes: 5 additions & 2 deletions lua/sidekick/cli/terminal.lua
Original file line number Diff line number Diff line change
Expand Up @@ -289,9 +289,12 @@ function M:open_win()
opts.height = opts.height <= 1 and math.floor(vim.o.lines * opts.height) or opts.height

if is_float then
opts.row = opts.row <= 1 and math.floor((vim.o.lines - (opts.height or 0)) * opts.row) or opts.row
opts.col = opts.col <= 1 and math.floor((vim.o.columns - (opts.width or 0)) * opts.col) or opts.col
opts.width, opts.height = math.max(opts.width, 80), math.max(opts.height, 10) -- minimum size
opts.row = opts.row <= 1 and math.floor((vim.o.lines - opts.height) * opts.row) or opts.row
opts.col = opts.col <= 1 and math.floor((vim.o.columns - opts.width) * opts.col) or opts.col
else
opts.width = opts.width > 0 and opts.width or nil -- auto split width
opts.height = opts.height > 0 and opts.height or nil -- auto split height
opts.vertical = self.opts.layout == "top" or self.opts.layout == "bottom"
opts.split = ({ top = "above", left = "left", bottom = "below", right = "right" })[self.opts.layout] or "right"
end
Expand Down
4 changes: 2 additions & 2 deletions lua/sidekick/config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ local defaults = {
-- Options used when layout is "left"|"bottom"|"top"|"right"
---@type vim.api.keyset.win_config
split = {
width = 80,
height = 20,
width = 80, -- set to 0 for default split with
height = 20, -- set to 0 for default split height
},
--- CLI Tool Keymaps (default mode is `t`)
---@type table<string, sidekick.cli.Keymap|false>
Expand Down