Custom view
The Custom view (fs :custom, alias :c) turns any command's output or piped standard input into a live f:st view with two-column rows, optional Lua row transforms, previews, sorting, and standard file operations.
Invocation and record format
Pass a command to run, or omit the command to read records from standard input:
fs :custom git status --porcelain
git ls-files | fs :customIf no command is given and standard input is an interactive terminal, fs :custom exits with an error. Run fs :custom --help for the full flag list.
Incoming bytes are parsed into rows in three steps:
- Record splitting splits the stream on
--input-sep(alias--is, default newline). Pass--input-sep=$'\0'for NUL-delimited producers such asfind -print0orgit status -z. Empty records are skipped. - Field splitting splits each record on the first occurrence of
--tail-sep(alias--ts) into(path, tail). When--tail-sepis omitted or absent from a record, the whole record ispathandtailis empty. - Path resolution resolves relative paths against the view's working directory, expanding
~.
Transforming rows with Lua
Passing --transform <LUA> compiles a Lua 5.4 chunk once and calls it for every record with local path, tail = .... Prefix the argument with @ (--transform @~/.config/fist/transforms/notes.lua) to load the script from a file.
local path, tail = ...
return path, display, tailThe chunk returns up to three values:
| Position | Value | Effect |
|---|---|---|
| 1 | path (string or nil) | Underlying path for previews and actions; nil drops the row |
| 2 | display (string or nil) | Custom text for column 1 (nil or "" keeps normal path rendering) |
| 3 | tail (string or nil) | Text for column 2 (nil keeps incoming tail; "" clears it) |
When display is non-empty, column 1 renders, fuzzy-matches, and alphabetically sorts by display, while previews, editors, and file operations continue to act on path. Typing % in the prompt filters column 2 (the tail). During a hard sort (mtime, atime, size), rows with an empty tail show the formatted sort value in column 2 instead.
The Find view (fs :: --transform <LUA>) supports the same contract with an empty incoming tail. A transform that fails to compile leaves rows untransformed; a runtime error stops stream ingestion at that row.
Caching and reloading
By default, fs :custom caches streamed rows in memory once the producer finishes. Returning to the view via Undo replays cached rows immediately, and pressing alt-r re-runs a command-backed producer for fresh output; stdin-backed views keep their cached rows across stack transitions because a closed pipe cannot be re-read.
Pass --no-store to skip the in-memory cache so command-backed views re-execute on every revisit or reload. Because rows are not held in memory under --no-store, post-stream re-sorting is unavailable.
A markdown notes manager
Combining a producer, --tail-sep, and --transform turns a folder of Markdown files into a categorized notes browser:
cd ~/vault
fs -i -t .md --list --format '{=}\t{-1.}' . |
fs :custom --tail-sep $'\t' --transform '
local path, vault = ...
local rel = ("/" .. path):match("^.-/" .. vault:gsub("%W", "%%%1") .. "/(.*)") or path
rel = rel:gsub("%.md$", "")
return path, rel, rel:match("^(.-)/") or ""
'The first command prints each note's path, a tab, and the vault folder name. The transform strips the vault prefix and .md suffix for display in column 1 and places the top-level folder in column 2, so typing % Prog filters to Programming. Because every row still resolves to its real file path, all standard view operations and menu actions work directly on the notes.
Common view defaults for Custom views live under [views.custom] in config.toml.