yazi/Keyshort/Copy GitHub markdown link
- Keyshort yazi yazi/Keyshort git GitHub git/Alias/md-url
- Copy a GitHub markdown link for the hovered or selected paths Keyshort/User #card
- Shortcut:
c then g (two-key sequence, both lowercase) - Context: User-defined binding — not a yazi default. Set in
~/.config/yazi/keymap.toml (managed via chezmoi dotfiles) as an [mgr]-layer prepend_keymap running shell "git md-url %s". It slots into yazi's preset c copy family — cc path, cC url, cd dirpath, cD dirurl, cf filename, cn stem — with g for GitHub. cG is deliberately left unbound, reserved for a bare-URL variant, so the family's lowercase-plain / uppercase-variant pairing keeps working. The work is done by git/Alias/md-url, so the same capability is reachable from a shell. - Description: Puts
[<repo>/<path-from-repo-root>](<github-url>) on the clipboard — e.g. [dotfiles/openspec/specs](https://github.com/codekiln/dotfiles/tree/main/openspec/specs). Works on files and directories alike. With several files selected it emits one link per line, matching what cc does for the same selection; with nothing selected it acts on the hovered file, because yazi's %s token falls back to hovered. Links always target the repository's default branch, never the checked-out one. - Fails safe: outside a GitHub-backed repository the clipboard is left untouched rather than filled with a wrong URL, and the binding is non-blocking so a keypress never parks the pane in a shell.
- My Notes The gap this fills was an open question first — see yazi/Q/Does yazi have a git integration that copies a file path relative to the repository root? If so, what is the keyshort?. Stock yazi has no repo-root-relative copy variant; this is the
shell workaround that answer pointed to.