Snatching text from Herdr
A couple of years ago I wrote about Extrakto, a tmux plugin that lets me find text in my terminal and insert it into the command I'm typing. I've missed that little trick while working in Herdr. A build prints the path I need, and there I am selecting it with the mouse or typing it out again.
So I built herdr-snatch. It puts an fzf picker over Herdr's output. Search for a path, URL, commit hash, word, or whole line, then press Enter to insert it into the pane you came from.
For example, if a build prints src/foo/parser.rs, I can type vim, open Snatch with prefix+Tab, search for pars, and press Enter. The path appears after vim, ready for me to run the command. Snatch doesn't press Enter for me, which is probably for the best.
It searches the visible output in the current tab by default. If the text was in another pane, or has scrolled away, I can switch to the whole workspace or retained scrollback without losing my search. Ctrl-Y copies the selection to the clipboard, and Ctrl-O opens a URL or file instead of inserting it.
To install it, you'll need Herdr 0.8.2 or newer, Python 3.9 or newer, and fzf:
herdr plugin install catlee/herdr-snatch
The README has the key binding I use and the other picker shortcuts. Right now this is a small tool for the paths and bits of output I keep reusing. If it misses something useful in your terminal, let me know!
Comments