Skip to content

feat(git): fish-style abbreviation for branch and worktree names - #614

Open
axisrow wants to merge 2 commits into
sirmalloc:mainfrom
axisrow:feat/fish-style-branch-worktree
Open

axisrow wants to merge 2 commits into
sirmalloc:mainfrom
axisrow:feat/fish-style-branch-worktree

Conversation

@axisrow

@axisrow axisrow commented Sep 27, 2026

Copy link
Copy Markdown

Closes #613

Problem

Branch and worktree names render at full length, so a status line carrying ⎇ fix/np/story-123 𖠰 dir/wt spends a lot of width on segments that mostly serve as a prefix. The Current Working Dir widget already has a fish-style mode that collapses path segments, but the git name widgets have no equivalent — and their default rendering is inconsistent with a fish-style cwd next to them.

Fix

Adds a per-widget fish-style mode to both Git Branch and Git Worktree (off by default, editor keybind (f)ish style, stored as metadata.fishStyle):

  • every name segment but the last collapses to its first character: main → m, feature/worktree → f/worktree, fix/np/story → f/p/story, worktree dir/wt → d/wt;
  • the TUI preview and the editor modifier text reflect the mode;
  • the repo link keeps the full branch name in the URL — only the visible label is abbreviated;
  • maxWidth still applies on top of the abbreviated text.

Verification

  • New tests in GitBranch.test.ts (plain and slashed branches, editor modifier + keybind) and GitWorktree.test.ts (main and nested worktrees, editor modifier + keybind).
  • Full suite: 2364 tests pass; bun run lint clean.
  • Live check against a real build: line renders ⎇ m 𖠰 m with both toggles enabled, ⎇ f/git-branch-fish-style on a long-running branch name.

🤖 Generated with Claude Code

axisrow and others added 2 commits September 28, 2026 01:11
Add a fishStyle metadata option (editor keybind (f)) to Git Branch:
every branch segment but the last collapses to its first character,
so 'main' renders as 'm' and 'fix/np/story' as 'f/p/story'. Mirrors
the existing fish-style mode of Current Working Dir. Link targets
keep the full branch name; the TUI preview reflects the mode.

Co-Authored-By: Claude Code <noreply@anthropic.com>
Same fishStyle option as Git Branch (editor keybind (f)): every
worktree name segment but the last collapses to its first character,
so 'main' renders as 'm' and 'dir/wt' as 'd/wt'.

Co-Authored-By: Claude Code <noreply@anthropic.com>
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.

feat(git): fish-style abbreviation for branch and worktree names

1 participant