Repository navigation
I can't copy a GitHub permalink to the current line, or open it on GitHub #604
Description
Opportunity
When I'm reading or reviewing code in TuiCode and want to point someone at a line, in a PR comment, a chat or an issue, I have no way to hand it over. I leave TuiCode, find the file on GitHub in a browser, scroll to the line and copy the URL, or run gh browse path:line in another shell. The same goes the other way: when I want to see the line on GitHub (its blame, the PR that touched it, to share a screen), there's no way to get there from where I am.
The stakeholder hit this while trying out #591 on PR #595 (comment): "I wanted to either copy a permalink to a line of code or open that line of code in GitHub... I can't do either of those at the moment."
Every editor the vision learns from has it: VS Code's Share › Copy GitHub Permalink and Open on GitHub, JetBrains' Open In › GitHub and Copy Link to GitHub, and Zed's Copy permalink to line / Open permalink to line. Reviewing PRs and sharing what you've read is most of the day for the vision's user.
Options considered
- Do nothing. Blame (
gb) shows the commit, andgh browseexists in a shell. Free, but it's exactly the trip to another tool the vision says to remove, and over SSH the browser isn't even on the same machine. - Copy the path and line only (
src/Foo.cs:42). Simple and host-agnostic, and handy for pasting into an AI chat, but it isn't a link: nobody can click it, and it rots as soon as the file changes. - Ask
gh browsefor the URL (gh browse --commit <sha> -n path:L). Reuses gh, which the Review tab already uses, and handles GitHub Enterprise. But it fails when gh isn't installed or signed in, and spawns a process that talks to the network for something we can work out fromgit remoteourselves. - Two commands that build the link from the repo's remote and the current commit (chosen). Copy permalink puts it on the clipboard; Open on GitHub opens it in the browser. Nothing new to install, it works offline, and it's built from git alone, so it's quick and testable.
I chose 4: it's what the other editors do, and it needs no more than git, which TuiCode already relies on.
Proposal
Two new commands on a file tab, in the Diff menu next to Git blame, in F1, the palette and the leader:
- Copy permalink (
cp): copieshttps://github.com/<owner>/<repo>/blob/<commit>/<path>#L42for the cursor's line, or#L42-L48when lines are selected. It goes through the editor's own copy, so it reaches your machine over SSH too (OSC 52). The status bar saysCopied permalink to line 42. - Open on GitHub (
oog): opens the same link in the browser, as Follow link does. Over SSH it copies it instead and says so, also as Follow link does.
The commit is HEAD's, so the link keeps pointing at the same code after the branch moves on. Where that would mislead, the status bar says so:
HEADisn't on the remote yet: Copy permalink still copies and saysCopied, but 4a91c0e isn't pushed yet: the link works once it is. Open on GitHub doesn't open a page that isn't there:4a91c0e isn't pushed yet: push it to open this line on GitHub.- The file has changes since
HEAD(unsaved or uncommitted): it still works, and addsthe file has changed since 4a91c0e, so line 42 there may not be this line. - Not a git repo, an untracked file, or no GitHub remote: nothing is copied or opened, and the status bar says why, the way blame does.
Mockup
The Diff menu (Alt+D):
┌ Diff ───────────────────────────────┐
│ Compare to saved │
│ Compare to revision │
│ Compare to other file │
├─────────────────────────────────────┤
│ Next change Alt+↓ │
│ Previous change Alt+↑ │
│ Go to change line │
├─────────────────────────────────────┤
│ Revert change │
│ Revert all changes │
├─────────────────────────────────────┤
│ Git blame Ctrl+G B │
│ Copy perMalink │
│ Open on GitHub │
└─────────────────────────────────────┘
(M and H are the items' letters, underlined.)
The status bar afterwards:
Copied permalink to lines 42–48 Ln 48, Col 1 Press F1 for help
Copied, but 4a91c0e isn't pushed yet: the link works once it is Ln 42, Col 9 Press F1 for help
Scope
In
- Copy permalink and Open on GitHub,
Editorscope, on file tabs, with mnemonics, menu items and F1 rows. github.comremotes in their SSH (git@github.com:o/r.git,ssh://git@github.com/o/r) and HTTPS forms, and GitHub Enterprise hosts, which use the same URL shape.- A selection of several lines; with several carets, the primary one.
Out
- Diff tabs. On a review,
Enteralready opens the file tab beside the diff, and that's where these work. Easy to add later if it's missed. - GitLab, Bitbucket and Azure DevOps links. Their URL shapes differ; the status bar says the remote isn't GitHub.
- A Copy relative path command, or a branch (not commit) link like VS Code's Copy GitHub Head Link.
- Pushing for you when
HEADisn't pushed. - Default keybindings. Both are a mnemonic away, and can be bound in Settings like any command.
Delivery
One PR.
Assumed
- The remote is the current branch's upstream's, else
origin, else the only one. That's the remote you push to, which is where the commit will be. - "On the remote" means some remote-tracking branch contains
HEAD(git branch -r --contains), read from what git already knows, with no fetch. A stale view errs towards warning, which is harmless. - Any host that isn't GitLab, Bitbucket or Azure DevOps is treated as GitHub or GitHub Enterprise. Enterprise hosts can have any name, so there's no list to check against; a wrong guess gives a link that 404s rather than a wrong page.
- Copying still happens when
HEADisn't pushed; opening doesn't. You often copy a link to paste after you push, but opening a page that isn't there helps nobody. - Diff menu, beside Git blame. It's where the other git-per-line command lives.
- Mnemonics
cpandoog, the labels' initials, as the mnemonic rule says. Neither clashes with or prefixes an existing one.
Original idea
There's no way to share or open the line under the cursor on GitHub. I'd like to either copy a permalink to the current line (or selection), or open that line in the browser on GitHub, built from the repo's remote and the current commit.
Follow-up from #591
Activity
a-team-app commentedon Oct 23, 2026
Recommended: Medium · theme 2 (Seeing change), small · sharing a line in a PR or chat is a daily thing; built from the remote and HEAD with no new UI beyond a command
a-team-app commentedon Oct 23, 2026
Took this next on my Medium recommendation, which put it ahead of the other High ideas. Drafted as two commands, Copy permalink (
cp) and Open on GitHub (oog), built from the remote andHEAD; it waits in Exploring for a slot in Pitched.a-team-app commentedon Oct 24, 2026
This is in front of you now. I checked it against today's main and didn't need to change anything: the Diff menu still has M and H free for the two items, and
cpandoogstill clash with no other mnemonic. There's nothing in it to answer, so it's yours to approve, change or shelve.