Open-Source Wikis

/

fzf

/

Reference

/

Configuration

junegunn/fzf

Configuration

fzf reads configuration from environment variables, an optional defaults file, and command-line flags. The CLI flags always win.

Defaults pipeline

  1. FZF_DEFAULT_OPTS_FILE — if set, read flags from this file (one shell-style argument per token, comments allowed).
  2. FZF_DEFAULT_OPTS — additional flags as a single string, parsed with go-shellwords.
  3. Command-line os.Args[1:] — final overrides.

Implemented near the top of ParseOptions in src/options.go.

Core environment variables

Variable Purpose
FZF_DEFAULT_COMMAND Command to run when stdin is a TTY (instead of the built-in walker).
FZF_DEFAULT_OPTS Shell-style default flags.
FZF_DEFAULT_OPTS_FILE Path to a defaults file.
FZF_API_KEY API key for non-localhost --listen.

Shell integration variables

These are consumed by the embedded shell scripts, not the Go binary:

Variable Purpose
FZF_CTRL_T_COMMAND, FZF_CTRL_T_OPTS Override Ctrl-T behavior.
FZF_CTRL_R_COMMAND, FZF_CTRL_R_OPTS Override Ctrl-R behavior.
FZF_ALT_C_COMMAND, FZF_ALT_C_OPTS Override Alt-C behavior.
FZF_COMPLETION_TRIGGER Trigger sequence for fuzzy completion (** by default).
FZF_COMPLETION_OPTS Default flags for completion fzf invocations.
FZF_COMPLETION_PATH_OPTS, FZF_COMPLETION_DIR_OPTS Per-source overrides.
FZF_TMUX, FZF_TMUX_HEIGHT, FZF_TMUX_OPTS Auto-route through fzf-tmux.

The exact lookup is in shell/key-bindings.{bash,zsh,fish} and shell/completion.{bash,zsh,fish}.

Display environment

Variable Effect
TERM Picked up by the renderer; affects color and capability assumptions.
LANG / LC_ALL Affect grapheme width calculations via github.com/rivo/uniseg.
COLUMNS / LINES Used when the renderer can't query the TTY directly.
NO_COLOR Disables color output if the user has set it.

Scoring schemes

--scheme=PRESET selects a preset:

  • default — general-purpose.
  • path — tuned for paths; gives extra bonus after /.
  • history — tuned for shell history; disables sort by score.

Implementation in src/algo/algo.go (the bonusBoundary* constants and Scheme selection in BuildPattern).

Tiebreakers

--tiebreak=A,B,C applies the listed criteria in order when scores tie. Available values: length, chunk, pathname, begin, end, index. Defined in src/options.go (byLength, byChunk, ...) and consumed by Result.Less in src/result.go.

Style presets

--style=PRESET[:BORDER_STYLE] is a one-line way to set borders, padding, and margin together:

  • default — minimal frame.
  • minimal — strip everything to the essentials.
  • full — full borders and labels everywhere.

Implementation in src/options.go (parseStyle) and src/terminal.go (border / padding / margin layout).

Color theme

--color=base[,FIELD:COLOR]* configures the palette. base is one of dark, light, base16, bw. The full color spec language is documented in the man page; parsing happens in src/options.go (parseTheme).

History

--history=FILE enables an editable, fzf-managed history of queries. Implementation in src/history.go.

Walker options

Flag Default Notes
--walker=file,dir,follow,hidden file,follow,hidden=false Pass dir to include directories, follow to follow symlinks (with the loop guard in src/reader.go), hidden to include dotfiles.
--walker-root=DIR[,DIR...] . Roots to walk.
--walker-skip=NAME[,NAME...] empty Directory names or paths to skip.

These compose with FZF_DEFAULT_COMMAND: if both are set, FZF_DEFAULT_COMMAND wins for the initial read, but the walker is used for subsequent reload actions that don't specify a command.

Profiling

When built with -tags pprof:

  • --profile-cpu PATH
  • --profile-mem PATH
  • --profile-block PATH
  • --profile-mutex PATH

Implementation in src/options_pprof.go.

Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.

Configuration – fzf wiki | Factory