# The Grep builtin (topbar word, `SPC f g`): `grep -R`, in-core. It arms the # SAME tag input `/` and Find use, but the walk reads file CONTENTS under every # pane's directory at once — minus any directory another pane's already # contains, so a tree two panes sit in is searched ONCE and every hit appears # once. A row is `path:LINE:COL-ENDCOL text` — the match's whole span, so # looking it SELECTS the hit — with the path RELATIVE to the directory # of the pane that asked — the same directory its results buffer is named in, # so the short name resolves; only a hit from outside that tree stays absolute. # n/N SELECT the next/prev row like any other result list and open nothing — # one press per row, the location at its head, never the matched text after it; # Enter looks what they leave selected, and a row pointing into a file nothing # has open yet opens it. dirmk sub file a.txt hello TARGET one\nnothing here\nlast TARGET line file sub/b.txt deep\nTARGET inside sub file noise.txt nothing to see # Builtins announce themselves by default, and an announcement is a band at # the top of the body -- which moves every row this script clicks. What the # verbs do is what is under test, not the announcement. config Verbose off # The stacked layout spends two rows on each hit, which puts the third one # below the fold of this results pane; the claim here is which hits there are. config LocationsConfig layout:inline start 31 180 -n 3 wait 8000 a.txt stable 700 20000 # open a.txt: a SECOND pane, whose directory the shell's cwd already covers — # its root is dropped, which is what keeps the hits below un-duplicated press left 5 9 release left 5 9 stable 400 5000 key i text a.txt key esc settle 100 stable 400 5000 press right 6 9 release right 6 9 wait 10000 hello TARGET stable 700 15000 snap opened # middle-click Grep on the topbar: the input # arms on the ACTIVE pane's tag, exactly where `/` would have typed press middle @Grep 1 release middle @Grep 1 stable 400 5000 text TARGET stable 400 5000 snap typing # Enter walks: two hits in a.txt, one in sub/b.txt, sorted by path — and the # file that holds none of them contributes no row. key enter wait 10000 sub/b.txt:2:1 stable 700 15000 snap results # n selects the first row and Enter looks it: absolute path, line 1, columns # 7..12 (`TARGET`), and those six cells come up selected key n key enter stable 700 15000 snap first # ...and stepping on into sub/b.txt, then looking it, opens the file nothing # had open key n key enter stable 700 15000 key n key enter wait 10000 TARGET inside sub stable 700 15000 snap opened-hit # a pattern nothing holds: an empty list of its own, with nothing in it for n # to stop on — so the ring carries that step out of it and on round. It lands # in the SHELL, whose `ls` row is free text and steps word by word: the TARGET # list is standing on its last row, and a row-grained walk has nothing left in # it to offer. The look above is why these read the way they do: it left the # cursor in sub/b.txt, so the empty list is named in sub/ rather than cwd/, and # it left the hit SELECTED there (a ranged result row is one a look selects). # Armed from the LEADER, not the topbar word, because of that selection: a # topbar execute chords whatever is selected into its argument, so a # middle-click here would run `Grep TARGET` and never ask for a pattern at # all. The leader path runs the builtin with no argument, which is what this # step is about; the chord itself is the last two snaps below. key space key f key g stable 400 5000 text zzqq key enter stable 700 10000 key n stable 400 5000 snap nomatch # the acme chord: a builtin executed with a SELECTION held takes it as the # argument, so dragging over `TARGET` in a.txt and then clicking Grep runs the # walk on that word at once — no tag input, nothing typed. TARGET already has # a list open from above, so this refills THAT one; only the zzqq list below is # a second buffer, because only it is a different search. press left @TARGET 8 drag left @TARGET+6 8 release left @TARGET+6 8 stable 400 5000 snap chordsel press middle @Grep 1 release middle @Grep 1 wait 10000 sub/b.txt:2:1 stable 700 15000 snap chord