Skip to content

feat(terminal): support top and bottom split_side - #312

Open
giuxtaposition wants to merge 1 commit into
coder:mainfrom
giuxtaposition:feat/split-side-top-bottom
Open

feat(terminal): support top and bottom split_side#312
giuxtaposition wants to merge 1 commit into
coder:mainfrom
giuxtaposition:feat/split-side-top-bottom

Conversation

@giuxtaposition

Copy link
Copy Markdown

Summary

Adds top and bottom to terminal.split_side (previously left/right only). Horizontal splits reuse terminal.split_width_percentage (and diff-time terminal.diff_split_width_percentage) as a fraction of vim.o.lines instead of vim.o.columns. Diff opening, closing, and new-tab teardown all pick the correct axis and wincmd per side.

  • Zero-config for existing users: left/right behavior unchanged.
  • Native provider: single create_split helper picks split/vsplit and topleft/botright per side; replaces two near-duplicate placement blocks in open_terminal and show_hidden_terminal.
  • Diff resize: resize_terminal_for_diff reads split_side and calls nvim_win_set_height for top/bottom, nvim_win_set_width for left/right.
  • New-tab diffs: wincmd move (H/L/K/J) and post-layout jump (h/l/j/k) picked from a small lookup table.
  • Small readability cleanup: rename resolve_split_width_percentageresolve_terminal_split_fraction (config keys keep their historical names; public API unchanged).
  • types.lua: new ClaudeCodeSplitSide alias covers all four values.

Usage

require("claudecode").setup({
  terminal = {
    split_side = "bottom",           -- "left" | "right" | "top" | "bottom"
    split_width_percentage = 0.30,   -- applied to lines for top/bottom, columns for left/right
    diff_split_width_percentage = 0.20, -- optional shrink while a diff is open
  },
})

Test plan

  • mise run check and mise run test.
  • Set split_side = "bottom" → Claude terminal opens as a bottom horizontal split sized to lines * split_width_percentage.
  • Set split_side = "top" → opens as a top horizontal split; topleft placement confirmed.
  • Trigger a Claude edit with split_side = "bottom" → diff opens, terminal shrinks to diff_split_width_percentage in height.
  • Accept/reject the diff → terminal restores to idle height, focus returns to expected window.
  • open_in_new_tab = true with split_side = "bottom" → new tab lays out with terminal below, diff above; jump lands in the diff pane.
  • Regression: split_side = "left" / "right" behavior unchanged (width-based).

Related issues

Closes #153

Some screenshots

Screenshot from 2026-08-14 15-24-38 Screenshot from 2026-08-14 15-24-10

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE] Horizontal terminal split

1 participant