Problem
When using tv text, I expect the interactive search to behave like "search file contents".
Right now, the interactive filter also matches the filename/path portion of each entry, because the
entry is shaped like:
path/to/file.ts:12:4:matched line text here
That means tv text is not strictly content-only from the user's point of view. A query can keep a
result visible because it matches the path, even when the matched line text does not contain that
query.
Feature
Allow a channel to define which field(s) participate in interactive matching, separately from the
displayed row and output value.
Conceptually, something like a match template:
[source]
command = "rg ..."
display = "{path}:{line}:{column}:{text}"
output = "{path}:{line}:{column}"
match = "{text}"
Or the equivalent as a CLI flag for ad-hoc channels.
This would make it possible to:
- use
files for filename/path search
- use
text for content-only search
- keep the current rich row display and preview behavior
without path text leaking into interactive text matching.
Examples
Example of current behavior:
tv text . \
--source-command "printf 'src/foo.ts:1:1:hello world\nlib/bar.ts:1:1:nope\n'" \
--input src \
--take-1
Current result:
Even though src only appears in the filename/path in this example, the row is still selected.
Example of the proposed configuration:
[source]
command = "rg ..."
display = "{path}:{line}:{column}:{text}"
output = "{path}:{line}:{column}"
match = "{text}"
Additional context
Environment:
This would make files and text feel like cleanly separate workflows:
files for filename/path matching
text for file-content matching
Problem
When using
tv text, I expect the interactive search to behave like "search file contents".Right now, the interactive filter also matches the filename/path portion of each entry, because the
entry is shaped like:
That means
tv textis not strictly content-only from the user's point of view. A query can keep aresult visible because it matches the path, even when the matched line text does not contain that
query.
Feature
Allow a channel to define which field(s) participate in interactive matching, separately from the
displayed row and output value.
Conceptually, something like a
matchtemplate:Or the equivalent as a CLI flag for ad-hoc channels.
This would make it possible to:
filesfor filename/path searchtextfor content-only searchwithout path text leaking into interactive text matching.
Examples
Example of current behavior:
Current result:
Even though
srconly appears in the filename/path in this example, the row is still selected.Example of the proposed configuration:
Additional context
Environment:
0.15.7This would make
filesandtextfeel like cleanly separate workflows:filesfor filename/path matchingtextfor file-content matching