main bf66a0c

Small CLI that copies file paths, file content, and GitHub URLs to your clipboard.

yank-that

yank-that is a small CLI that copies useful values to your clipboard:

  • resolved file paths
  • file contents
  • GitHub file URLs (with optional line anchors)

Install

go install github.com/bnema/yank-that/cmd/yt@latest

Commands

  • yt path [target] (ytp shell alias): copy resolved absolute path
  • yt content <file> (ytc shell alias): copy file content
  • yt github <file[:line]> (ytg shell alias): copy GitHub blob URL

Examples

# path
yt path
yt path .
yt path file.txt
yt path ../foo

# content
yt content file.txt
yt content ../notes.md

# github URL
yt github README.md
yt github internal/app/app.go:42

Shell aliases

Install aliases for ytp, ytc, and ytg:

yt install-aliases

Install for one shell only:

yt install-aliases bash
yt install-aliases zsh
yt install-aliases fish

Then reload your shell config (for example, source ~/.bashrc, source ~/.zshrc, or restart fish).

Requirements

Install at least one clipboard backend:

  • wl-copy (Wayland)
  • xclip (X11)

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. On pages with a side panel: into the panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit; in a file, click a line number to select it, shift-click for a range
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 2

Tags 4

↑↓ moveenter openesc close