Skip to content

Search view ​

The Search view searches file contents across a directory tree using ripgrep, pairs each matched file path with its line context, and lets you switch on the fly between live full-text querying and in-memory fuzzy filtering.

Entering the Search view ​

Launch the Search view from the command line with fs :, or press ctrl-r from any view:

shell
fs : TODO
fs : -p src -p tests TODO # search under src/ and tests/

When you press ctrl-r inside another view with rows selected, the search is scoped to those selected paths; otherwise it searches the current working directory.

Run fs : --help for the full flag list.

Query mode and filter mode ​

Press ctrl-r inside the Search view to toggle between query mode (re-running the full-text search as you type) and filter mode (fuzzy-narrowing the current matches in memory without re-searching).

In filter mode, % splits the query so text before % matches the file path in column 1 and text after % matches the line content in column 2 (src/api % Bearer).

Because the prompt shows only the active mode's text, [views.search] provides rg_status_template (shown in query mode with {} replaced by your saved filter text) and fs_status_template (shown in filter mode with {} replaced by the active search patterns).

Patterns, quoting, and matching ​

In query mode, unquoted spaces split the prompt into separate OR-combined patterns (fn struct matches lines containing either fn or struct). Wrap a phrase in single quotes ('fn main') to keep spaces inside one pattern, and escape a literal single quote as \'. Passing --preserve-whitespace or setting preserve_whitespace = true under [views.search] prepends a leading ' to the prompt so spaces stay in a single pattern without manual quoting.

Query mode evaluates patterns as regular expressions by default, whereas filter mode always performs literal fuzzy matching. Press ctrl-s in the Search view (or set fixed_strings = true / pass --fixed-strings) to switch query mode to literal strings, and press ctrl-d (or pass -S, -s, -c) to cycle smart, sensitive, and ignored case. Use -A, -B, and -C to include surrounding context lines.

When the prompt is empty in query mode, [views.search] empty_pattern supplies a fallback pattern (a leading -v inverts matching, so "-v ^ *$" lists every non-blank line). When empty_pattern is unset, an empty prompt shows no matches.

Row layout ​

Column 1 holds the file path and column 2 (the tail) holds the matched line text. Two layouts control how multiple matches in the same file appear, configured by --one-line / -1 or one_line under [views.search]:

  • One-line mode (one_line = true) puts each matched line on its own row, with its context window in column 2 when -A, -B, or -C is set.
  • Stacked mode (one_line = false) groups all matches for a file into a single row, stacking the match blocks beneath the file path.

Visibility and Configuration ​

The Search view honors f:st's visibility flags and -t filetype filters. You can also define folder-scoped case-insensitive globs under [views.search.iglobs] in config.toml:

toml
[views.search.iglobs]
"" = ["!*.lock", "!*.min.js"]
"~/work/harborlight" = ["!fixtures/**"]

Globs under "" apply everywhere; globs keyed by a directory path (~ expands to your home directory) apply when searching from that directory. Enabling all visibility (-u) bypasses iglobs.

All Search view settings live under [views.search] in config.toml.

Acting on a match ​

Every match row records its 1-based line and column (HIGHLIGHT_LINE and HIGHLIGHT_COLUMN). The preview panel centers on and highlights the matched line, and pressing Advance (right) or enter passes those coordinates to [interface] advance_command and the lessfilter edit preset so your editor opens directly at the match.