Add keyboard shortcuts to copy (a) the path of the highlighted entry and
(b) the contents of the highlighted file to the system clipboard, without
leaving peektea.
Motivation
Today the only way to act on an entry is o (open with configured program).
A common workflow is wanting the path or the contents on the clipboard so
you can paste it into a terminal, an editor, a chat, or a command — e.g.
cd <paste>, cat <paste>, or pasting a small config/snippet somewhere.
Right now that means leaving the browser and re-typing or re-navigating.
Proposed behavior
Two new keys, following the vim "yank" mnemonic so they don't collide with
the existing bindings:
| Key |
Action |
y |
copy the absolute path of the highlighted entry (file or directory) |
Y |
copy the contents of the highlighted file |
Details:
y works on both files and directories.
Y on a directory is a no-op (or shows a hint like Y only works on files).
Y on a binary file should refuse and show a notice, consistent with how
the preview panel already shows [binary file].
- On success, show a brief confirmation in the hint bar, e.g.
copied path / copied contents (N lines).
Clipboard / platform notes
peektea already routes opens differently per platform (wslview/explorer.exe
on WSL, etc.), so copy should be platform-aware too:
- macOS —
pbcopy
- Linux (Wayland) —
wl-copy
- Linux (X11) —
xclip / xsel
- WSL —
clip.exe
Alternatively, a cross-platform Go clipboard library (e.g.
github.com/atotto/clipboard) could cover most cases, with a graceful
fallback + hint when no clipboard provider is found.
Open questions
- Should
Y cap large files the way preview caps at 500 lines, or copy the
full file regardless of size?
- For WSL, should
y copy the Linux path or the Windows path (via wslpath),
given opens already convert to Windows paths?
- Add these keys to the README Keys table and the
-h help output.
Acceptance criteria
Add keyboard shortcuts to copy (a) the path of the highlighted entry and
(b) the contents of the highlighted file to the system clipboard, without
leaving peektea.
Motivation
Today the only way to act on an entry is
o(open with configured program).A common workflow is wanting the path or the contents on the clipboard so
you can paste it into a terminal, an editor, a chat, or a command — e.g.
cd <paste>,cat <paste>, or pasting a small config/snippet somewhere.Right now that means leaving the browser and re-typing or re-navigating.
Proposed behavior
Two new keys, following the vim "yank" mnemonic so they don't collide with
the existing bindings:
yYDetails:
yworks on both files and directories.Yon a directory is a no-op (or shows a hint likeY only works on files).Yon a binary file should refuse and show a notice, consistent with howthe preview panel already shows
[binary file].copied path/copied contents (N lines).Clipboard / platform notes
peektea already routes opens differently per platform (
wslview/explorer.exeon WSL, etc.), so copy should be platform-aware too:
pbcopywl-copyxclip/xselclip.exeAlternatively, a cross-platform Go clipboard library (e.g.
github.com/atotto/clipboard) could cover most cases, with a gracefulfallback + hint when no clipboard provider is found.
Open questions
Ycap large files the way preview caps at 500 lines, or copy thefull file regardless of size?
ycopy the Linux path or the Windows path (viawslpath),given opens already convert to Windows paths?
-hhelp output.Acceptance criteria
ycopies the absolute path of the highlighted file or directory.Ycopies the contents of the highlighted file.Y.peektea -hupdated.