Skip to content
Myr

README.md

This file

Path

README.md

701 lines · 21.4 KiB · Markdown

Last changed by

Merge branch 'devel' into masterJunegunn Choibefore adoption51dfacd

History of this file

Take it

The walk stopped after 200 commits: lines older than 577024f point at it.

Use rounded cornersJunegunn Choibefore adoption577024f

lines 1–24why, one step back
1<img src="https://raw.githubusercontent.com/junegunn/i/master/fzf.png" height="170" alt="fzf - a command-line fuzzy finder"> [![travis-ci](https://travis-ci.org/junegunn/fzf.svg?branch=master)](https://travis-ci.org/junegunn/fzf)
2===34fzf is a general-purpose command-line fuzzy finder.56<img src="https://raw.githubusercontent.com/junegunn/i/master/fzf-preview.png" width=640>78It's an interactive Unix filter for command-line that can be used with any9list; files, command history, processes, hostnames, bookmarks, git commits,10etc.1112Pros13----1415- Portable, no dependencies16- Blazingly fast17- The most comprehensive feature set18- Flexible layout19- Batteries included20 - Vim/Neovim plugin, key bindings and fuzzy auto-completion2122Table of Contents23-----------------24

Show how to use reload actionJunegunn Choibefore adoption825d401

line 25why, one step back
25<!-- vim-markdown-toc GFM -->

Use rounded cornersJunegunn Choibefore adoption577024f

line 26why, one step back
26

Show how to use reload actionJunegunn Choibefore adoption825d401

lines 27–69why, one step back
27* [Installation](#installation)
28 * [Using Homebrew or Linuxbrew](#using-homebrew-or-linuxbrew)29 * [Using git](#using-git)30 * [Using Linux package managers](#using-linux-package-managers)31 * [Windows](#windows)32 * [As Vim plugin](#as-vim-plugin)33* [Upgrading fzf](#upgrading-fzf)34* [Building fzf](#building-fzf)35* [Usage](#usage)36 * [Using the finder](#using-the-finder)37 * [Layout](#layout)38 * [Search syntax](#search-syntax)39 * [Environment variables](#environment-variables)40 * [Options](#options)41 * [Demo](#demo)42* [Examples](#examples)43* [`fzf-tmux` script](#fzf-tmux-script)44* [Key bindings for command-line](#key-bindings-for-command-line)45* [Fuzzy completion for bash and zsh](#fuzzy-completion-for-bash-and-zsh)46 * [Files and directories](#files-and-directories)47 * [Process IDs](#process-ids)48 * [Host names](#host-names)49 * [Environment variables / Aliases](#environment-variables--aliases)50 * [Settings](#settings)51 * [Supported commands](#supported-commands)52 * [Custom fuzzy completion](#custom-fuzzy-completion)53* [Vim plugin](#vim-plugin)54* [Advanced topics](#advanced-topics)55 * [Performance](#performance)56 * [Executing external programs](#executing-external-programs)57 * [Reloading the candidate list](#reloading-the-candidate-list)58 * [1. Update the list of processes by pressing CTRL-R](#1-update-the-list-of-processes-by-pressing-ctrl-r)59 * [2. Switch between sources by pressing CTRL-D or CTRL-F](#2-switch-between-sources-by-pressing-ctrl-d-or-ctrl-f)60 * [3. Interactive ripgrep integration](#3-interactive-ripgrep-integration)61 * [Preview window](#preview-window)62* [Tips](#tips)63 * [Respecting `.gitignore`](#respecting-gitignore)64 * [Fish shell](#fish-shell)65* [Related projects](#related-projects)66* [License](#license)6768<!-- vim-markdown-toc -->69

Use rounded cornersJunegunn Choibefore adoption577024f

lines 70–84why, one step back
70Installation
71------------7273fzf project consists of the following components:7475- `fzf` executable76- `fzf-tmux` script for launching fzf in a tmux pane77- Shell extensions78 - Key bindings (`CTRL-T`, `CTRL-R`, and `ALT-C`) (bash, zsh, fish)79 - Fuzzy auto-completion (bash, zsh)80- Vim/Neovim plugin8182You can [download fzf executable][bin] alone if you don't need the extra83stuff.84

Merge branch 'devel' into masterJunegunn Choibefore adoption51dfacd

line 85why, one step back
85[bin]: https://github.com/junegunn/fzf/releases

Use rounded cornersJunegunn Choibefore adoption577024f

lines 86–114why, one step back
86
87### Using Homebrew or Linuxbrew8889You can use [Homebrew](http://brew.sh/) or [Linuxbrew](http://linuxbrew.sh/)90to install fzf.9192```sh93brew install fzf9495# To install useful key bindings and fuzzy completion:96$(brew --prefix)/opt/fzf/install97```9899fzf is also available [via MacPorts][portfile]: `sudo port install fzf`100101[portfile]: https://github.com/macports/macports-ports/blob/master/sysutils/fzf/Portfile102103### Using git104105Alternatively, you can "git clone" this repository to any directory and run106[install](https://github.com/junegunn/fzf/blob/master/install) script.107108```sh109git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf110~/.fzf/install111```112113### Using Linux package managers114

Add conda installation instructionJunegunn Choibefore adoption98ca4bd

lines 115–120why, one step back
115| Package Manager | Linux Distribution | Command |
116| --- | --- | --- |117| APK | Alpine Linux | `sudo apk add fzf` |118| APT | Debian 9+/Ubuntu 19.10+ | `sudo apt-get install fzf` |119| Conda | | `conda install -c conda-forge fzf` |120| DNF | Fedora | `sudo dnf install fzf` |

README: Correct Nix distro support (#2051)Atemubefore adoptiondda3e3c

line 121why, one step back
121| Nix | NixOS, etc. | `nix-env -iA nixpkgs.fzf` |

Add conda installation instructionJunegunn Choibefore adoption98ca4bd

lines 122–124why, one step back
122| Pacman | Arch Linux | `sudo pacman -S fzf` |
123| pkg | FreeBSD | `pkg install fzf` |124| pkg_add | OpenBSD | `pkg_add fzf` |

Void Linux installation instructions (#2100)anntnzrbbefore adoptionfd51579

line 125why, one step back
125| XBPS | Void Linux | `sudo xbps-install -S fzf` |

Add conda installation instructionJunegunn Choibefore adoption98ca4bd

line 126why, one step back
126| Zypper | openSUSE | `sudo zypper install fzf` |

Use rounded cornersJunegunn Choibefore adoption577024f

line 127why, one step back
127

Clarify that additional installation steps may be requiredJunegunn Choibefore adoptionb0987f7

lines 128–131why, one step back
128> :warning: **Key bindings (CTRL-T / CTRL-R / ALT-C) and fuzzy auto-completion
129> may not be enabled by default.**130>131> Refer to the package documentation for more information. (e.g. `apt-cache show fzf`)

Use rounded cornersJunegunn Choibefore adoption577024f

lines 132–152why, one step back
132
133### Windows134135Pre-built binaries for Windows can be downloaded [here][bin]. fzf is also136available via [Chocolatey][choco] and [Scoop][scoop]:137138| Package manager | Command |139| --- | --- |140| Chocolatey | `choco install fzf` |141| Scoop | `scoop install fzf` |142143[choco]: https://chocolatey.org/packages/fzf144[scoop]: https://github.com/ScoopInstaller/Main/blob/master/bucket/fzf.json145146Known issues and limitations on Windows can be found on [the wiki147page][windows-wiki].148149[windows-wiki]: https://github.com/junegunn/fzf/wiki/Windows150151### As Vim plugin152

[vim] Add fzf#install() for downloading fzf binaryJunegunn Choibefore adoption6c03571

lines 153–155why, one step back
153If you use
154[vim-plug](https://github.com/junegunn/vim-plug), add this line to your Vim155configuration file:

Use rounded cornersJunegunn Choibefore adoption577024f

lines 156–157why, one step back
156
157```vim

[vim] Add fzf#install() for downloading fzf binaryJunegunn Choibefore adoption6c03571

line 158why, one step back
158Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }

Use rounded cornersJunegunn Choibefore adoption577024f

lines 159–160why, one step back
159```
160

[vim] Add fzf#install() for downloading fzf binaryJunegunn Choibefore adoption6c03571

lines 161–162why, one step back
161`fzf#install()` makes sure that you have the latest binary, but it's optional,
162so you can omit it if you use a plugin manager that doesn't support hooks.

Use rounded cornersJunegunn Choibefore adoption577024f

line 163why, one step back
163

[vim] Add fzf#install() for downloading fzf binaryJunegunn Choibefore adoption6c03571

line 164why, one step back
164For more installation options, see [README-VIM.md](README-VIM.md).

Use rounded cornersJunegunn Choibefore adoption577024f

lines 165–174why, one step back
165
166Upgrading fzf167-------------168169fzf is being actively developed and you might want to upgrade it once in a170while. Please follow the instruction below depending on the installation171method used.172173- git: `cd ~/.fzf && git pull && ./install`174- brew: `brew update; brew reinstall fzf`

Update README.md: MacPorts upgrade instruction (#1893)Chrisbefore adoptiond8cb5c1

line 175why, one step back
175- macports: `sudo port upgrade fzf`

Use rounded cornersJunegunn Choibefore adoption577024f

lines 176–294why, one step back
176- chocolatey: `choco upgrade fzf`
177- vim-plug: `:PlugUpdate fzf`178179Building fzf180------------181182See [BUILD.md](BUILD.md).183184Usage185-----186187fzf will launch interactive finder, read the list from STDIN, and write the188selected item to STDOUT.189190```sh191find * -type f | fzf > selected192```193194Without STDIN pipe, fzf will use find command to fetch the list of195files excluding hidden ones. (You can override the default command with196`FZF_DEFAULT_COMMAND`)197198```sh199vim $(fzf)200```201202#### Using the finder203204- `CTRL-J` / `CTRL-K` (or `CTRL-N` / `CTRL-P`) to move cursor up and down205- `Enter` key to select the item, `CTRL-C` / `CTRL-G` / `ESC` to exit206- On multi-select mode (`-m`), `TAB` and `Shift-TAB` to mark multiple items207- Emacs style key bindings208- Mouse: scroll, click, double-click; shift-click and shift-scroll on209 multi-select mode210211#### Layout212213fzf by default starts in fullscreen mode, but you can make it start below the214cursor with `--height` option.215216```sh217vim $(fzf --height 40%)218```219220Also check out `--reverse` and `--layout` options if you prefer221"top-down" layout instead of the default "bottom-up" layout.222223```sh224vim $(fzf --height 40% --reverse)225```226227You can add these options to `$FZF_DEFAULT_OPTS` so that they're applied by228default. For example,229230```sh231export FZF_DEFAULT_OPTS='--height 40% --layout=reverse --border'232```233234#### Search syntax235236Unless otherwise specified, fzf starts in "extended-search mode" where you can237type in multiple search terms delimited by spaces. e.g. `^music .mp3$ sbtrkt238!fire`239240| Token | Match type | Description |241| --------- | -------------------------- | ------------------------------------ |242| `sbtrkt` | fuzzy-match | Items that match `sbtrkt` |243| `'wild` | exact-match (quoted) | Items that include `wild` |244| `^music` | prefix-exact-match | Items that start with `music` |245| `.mp3$` | suffix-exact-match | Items that end with `.mp3` |246| `!fire` | inverse-exact-match | Items that do not include `fire` |247| `!^music` | inverse-prefix-exact-match | Items that do not start with `music` |248| `!.mp3$` | inverse-suffix-exact-match | Items that do not end with `.mp3` |249250If you don't prefer fuzzy matching and do not wish to "quote" every word,251start fzf with `-e` or `--exact` option. Note that when `--exact` is set,252`'`-prefix "unquotes" the term.253254A single bar character term acts as an OR operator. For example, the following255query matches entries that start with `core` and end with either `go`, `rb`,256or `py`.257258```259^core go$ | rb$ | py$260```261262#### Environment variables263264- `FZF_DEFAULT_COMMAND`265 - Default command to use when input is tty266 - e.g. `export FZF_DEFAULT_COMMAND='fd --type f'`267- `FZF_DEFAULT_OPTS`268 - Default options269 - e.g. `export FZF_DEFAULT_OPTS="--layout=reverse --inline-info"`270271#### Options272273See the man page (`man fzf`) for the full list of options.274275#### Demo276If you learn by watching videos, check out this screencast by [@samoshkin](https://github.com/samoshkin) to explore `fzf` features.277278<a title="fzf - command-line fuzzy finder" href="https://www.youtube.com/watch?v=qgG5Jhi_Els">279 <img src="https://i.imgur.com/vtG8olE.png" width="640">280</a>281282Examples283--------284285Many useful examples can be found on [the wiki286page](https://github.com/junegunn/fzf/wiki/examples). Feel free to add your287own as well.288289`fzf-tmux` script290-----------------291292[fzf-tmux](bin/fzf-tmux) is a bash script that opens fzf in a tmux pane.293294```sh

[fzf-tmux] Add option to start fzf in tmux popup windowJunegunn Choibefore adoptionbf65e8c

line 295why, one step back
295# usage: fzf-tmux [LAYOUT OPTIONS] [--] [FZF OPTIONS]

Use rounded cornersJunegunn Choibefore adoption577024f

line 296why, one step back
296

[fzf-tmux] Add option to start fzf in tmux popup windowJunegunn Choibefore adoptionbf65e8c

lines 297–299why, one step back
297# See available options
298fzf-tmux --help299

Use rounded cornersJunegunn Choibefore adoption577024f

lines 300–306why, one step back
300# select git branches in horizontal split below (15 lines)
301git branch | fzf-tmux -d 15302303# select multiple words in vertical split on the left (20% of screen width)304cat /usr/share/dict/words | fzf-tmux -l 20% --multi --reverse305```306

[fzf-tmux] Add option to start fzf in tmux popup windowJunegunn Choibefore adoptionbf65e8c

line 307why, one step back
307It will still work even when you're not on tmux, silently ignoring `-[pudlr]`

Use rounded cornersJunegunn Choibefore adoption577024f

lines 308–333why, one step back
308options, so you can invariably use `fzf-tmux` in your scripts.
309310Alternatively, you can use `--height HEIGHT[%]` option not to start fzf in311fullscreen mode.312313```sh314fzf --height 40%315```316317Key bindings for command-line318-----------------------------319320The install script will setup the following key bindings for bash, zsh, and321fish.322323- `CTRL-T` - Paste the selected files and directories onto the command-line324 - Set `FZF_CTRL_T_COMMAND` to override the default command325 - Set `FZF_CTRL_T_OPTS` to pass additional options326- `CTRL-R` - Paste the selected command from history onto the command-line327 - If you want to see the commands in chronological order, press `CTRL-R`328 again which toggles sorting by relevance329 - Set `FZF_CTRL_R_OPTS` to pass additional options330- `ALT-C` - cd into the selected directory331 - Set `FZF_ALT_C_COMMAND` to override the default command332 - Set `FZF_ALT_C_OPTS` to pass additional options333

[fzf-tmux] Add option to start fzf in tmux popup windowJunegunn Choibefore adoptionbf65e8c

lines 334–336why, one step back
334If you're on a tmux session, you can start fzf in a tmux split pane or in
335a tmux popup window by setting `FZF_TMUX_OPTS` (e.g. `-d 40%`).336See `fzf-tmux --help` for available options.

Use rounded cornersJunegunn Choibefore adoption577024f

lines 337–420why, one step back
337
338More tips can be found on [the wiki page](https://github.com/junegunn/fzf/wiki/Configuring-shell-key-bindings).339340Fuzzy completion for bash and zsh341---------------------------------342343#### Files and directories344345Fuzzy completion for files and directories can be triggered if the word before346the cursor ends with the trigger sequence which is by default `**`.347348- `COMMAND [DIRECTORY/][FUZZY_PATTERN]**<TAB>`349350```sh351# Files under current directory352# - You can select multiple items with TAB key353vim **<TAB>354355# Files under parent directory356vim ../**<TAB>357358# Files under parent directory that match `fzf`359vim ../fzf**<TAB>360361# Files under your home directory362vim ~/**<TAB>363364365# Directories under current directory (single-selection)366cd **<TAB>367368# Directories under ~/github that match `fzf`369cd ~/github/fzf**<TAB>370```371372#### Process IDs373374Fuzzy completion for PIDs is provided for kill command. In this case,375there is no trigger sequence, just press tab key after kill command.376377```sh378# Can select multiple processes with <TAB> or <Shift-TAB> keys379kill -9 <TAB>380```381382#### Host names383384For ssh and telnet commands, fuzzy completion for host names is provided. The385names are extracted from /etc/hosts and ~/.ssh/config.386387```sh388ssh **<TAB>389telnet **<TAB>390```391392#### Environment variables / Aliases393394```sh395unset **<TAB>396export **<TAB>397unalias **<TAB>398```399400#### Settings401402```sh403# Use ~~ as the trigger sequence instead of the default **404export FZF_COMPLETION_TRIGGER='~~'405406# Options to fzf command407export FZF_COMPLETION_OPTS='+c -x'408409# Use fd (https://github.com/sharkdp/fd) instead of the default find410# command for listing path candidates.411# - The first argument to the function ($1) is the base path to start traversal412# - See the source code (completion.{bash,zsh}) for the details.413_fzf_compgen_path() {414 fd --hidden --follow --exclude ".git" . "$1"415}416417# Use fd to generate the list for directory completion418_fzf_compgen_dir() {419 fd --type d --hidden --follow --exclude ".git" . "$1"420}

[completion] Allow users to customize fzf options via _fzf_comprunJunegunn Choibefore adoption5215415

lines 421–430why, one step back
421
422# (EXPERIMENTAL) Advanced customization of fzf options via _fzf_comprun function423# - The first argument to the function is the name of the command.424# - You should make sure to pass the rest of the arguments to fzf.425_fzf_comprun() {426 local command=$1427 shift428429 case "$command" in430 cd) fzf "$@" --preview 'tree -C {} | head -200' ;;

Change custom fuzzy completion APIJunegunn Choibefore adoption50b7608

line 431why, one step back
431 export|unset) fzf "$@" --preview "eval 'echo \$'{}" ;;

[completion] Allow users to customize fzf options via _fzf_comprunJunegunn Choibefore adoption5215415

lines 432–435why, one step back
432 ssh) fzf "$@" --preview 'dig {}' ;;
433 *) fzf "$@" ;;434 esac435}

Use rounded cornersJunegunn Choibefore adoption577024f

lines 436–447why, one step back
436```
437438#### Supported commands439440On bash, fuzzy completion is enabled only for a predefined set of commands441(`complete | grep _fzf` to see the list). But you can enable it for other442commands as well by using `_fzf_setup_completion` helper function.443444```sh445# usage: _fzf_setup_completion path|dir|var|alias|host COMMANDS...446_fzf_setup_completion path ag git kubectl447_fzf_setup_completion dir tree

Change custom fuzzy completion APIJunegunn Choibefore adoption50b7608

lines 448–497why, one step back
448```
449450#### Custom fuzzy completion451452_**(Custom completion API is experimental and subject to change)**_453454For a command named _"COMMAND"_, define `_fzf_complete_COMMAND` function using455`_fzf_complete` helper.456457```sh458# Custom fuzzy completion for "doge" command459# e.g. doge **<TAB>460_fzf_complete_doge() {461 _fzf_complete --multi --reverse --prompt="doge> " -- "$@" < <(462 echo very463 echo wow464 echo such465 echo doge466 )467}468```469470- The arguments before `--` are the options to fzf.471- After `--`, simply pass the original completion arguments unchanged (`"$@"`).472- Then write a set of commands that generates the completion candidates and473 feed its output to the function using process substitution (`< <(...)`).474475zsh will automatically pick up the function using the naming convention but in476bash you have to manually associate the function with the command using477`complete` command.478479```sh480[ -n "$BASH" ] && complete -F _fzf_complete_doge -o default -o bashdefault doge481```482483If you need to post-process the output from fzf, define484`_fzf_complete_COMMAND_post` as follows.485486```sh487_fzf_complete_foo() {488 _fzf_complete --multi --reverse --header-lines=3 -- "$@" < <(489 ls -al490 )491}492493_fzf_complete_foo_post() {494 awk '{print $NF}'495}496497[ -n "$BASH" ] && complete -F _fzf_complete_foo -o default -o bashdefault foo

Use rounded cornersJunegunn Choibefore adoption577024f

lines 498–538why, one step back
498```
499500Vim plugin501----------502503See [README-VIM.md](README-VIM.md).504505Advanced topics506---------------507508### Performance509510fzf is fast and is [getting even faster][perf]. Performance should not be511a problem in most use cases. However, you might want to be aware of the512options that affect the performance.513514- `--ansi` tells fzf to extract and parse ANSI color codes in the input and it515 makes the initial scanning slower. So it's not recommended that you add it516 to your `$FZF_DEFAULT_OPTS`.517- `--nth` makes fzf slower as fzf has to tokenize each line.518- `--with-nth` makes fzf slower as fzf has to tokenize and reassemble each519 line.520- If you absolutely need better performance, you can consider using521 `--algo=v1` (the default being `v2`) to make fzf use a faster greedy522 algorithm. However, this algorithm is not guaranteed to find the optimal523 ordering of the matches and is not recommended.524525[perf]: https://junegunn.kr/images/fzf-0.17.0.png526527### Executing external programs528529You can set up key bindings for starting external processes without leaving530fzf (`execute`, `execute-silent`).531532```bash533# Press F1 to open the file with less without leaving fzf534# Press CTRL-Y to copy the line to clipboard and aborts fzf (requires pbcopy)535fzf --bind 'f1:execute(less -f {}),ctrl-y:execute-silent(echo {} | pbcopy)+abort'536```537538See *KEY BINDINGS* section of the man page for details.

Show how to use reload actionJunegunn Choibefore adoption825d401

lines 539–582why, one step back
539
540### Reloading the candidate list541542By binding `reload` action to a key or an event, you can make fzf dynamically543reload the candidate list. See https://github.com/junegunn/fzf/issues/1750 for544more details.545546#### 1. Update the list of processes by pressing CTRL-R547548```sh549FZF_DEFAULT_COMMAND='ps -ef' \550 fzf --bind 'ctrl-r:reload($FZF_DEFAULT_COMMAND)' \551 --header 'Press CTRL-R to reload' --header-lines=1 \552 --height=50% --layout=reverse553```554555#### 2. Switch between sources by pressing CTRL-D or CTRL-F556557```sh558FZF_DEFAULT_COMMAND='find . -type f' \559 fzf --bind 'ctrl-d:reload(find . -type d),ctrl-f:reload($FZF_DEFAULT_COMMAND)' \560 --height=50% --layout=reverse561```562563#### 3. Interactive ripgrep integration564565The following example uses fzf as the selector interface for ripgrep. We bound566`reload` action to `change` event, so every time you type on fzf, ripgrep567process will restart with the updated query string denoted by the placeholder568expression `{q}`. Also, note that we used `--phony` option so that fzf doesn't569perform any secondary filtering.570571```sh572INITIAL_QUERY=""573RG_PREFIX="rg --column --line-number --no-heading --color=always --smart-case "574FZF_DEFAULT_COMMAND="$RG_PREFIX '$INITIAL_QUERY'" \575 fzf --bind "change:reload:$RG_PREFIX {q} || true" \576 --ansi --phony --query "$INITIAL_QUERY" \577 --height=50% --layout=reverse578```579580If ripgrep doesn't find any matches, it will exit with a non-zero exit status,581and fzf will warn you about it. To suppress the warning message, we added582`|| true` to the command, so that it always exits with 0.

Use rounded cornersJunegunn Choibefore adoption577024f

lines 583–585why, one step back
583
584### Preview window585

Implement streaming preview window (#2215)Junegunn Choibefore adoptionfaf68db

lines 586–588why, one step back
586When the `--preview` option is set, fzf automatically starts an external process
587with the current line as the argument and shows the result in the split window.588Your `$SHELL` is used to execute the command with `$SHELL -c COMMAND`.

README: Use --line-range instead of head in bat example (#2064)Janekbefore adoption43d1c4c

line 589why, one step back
589The window can be scrolled using the mouse or custom key bindings.

Use rounded cornersJunegunn Choibefore adoption577024f

lines 590–596why, one step back
590
591```bash592# {} is replaced to the single-quoted string of the focused line593fzf --preview 'cat {}'594```595596Preview window supports ANSI colors, so you can use any program that

Implement streaming preview window (#2215)Junegunn Choibefore adoptionfaf68db

line 597why, one step back
597syntax-highlights the content of a file, such as

README: Use --line-range instead of head in bat example (#2064)Janekbefore adoption43d1c4c

lines 598–599why, one step back
598[Bat](https://github.com/sharkdp/bat) or
599[Highlight](http://www.andre-simon.de/doku/highlight/en/highlight.php):

Use rounded cornersJunegunn Choibefore adoption577024f

lines 600–601why, one step back
600
601```bash

README: Use --line-range instead of head in bat example (#2064)Janekbefore adoption43d1c4c

line 602why, one step back
602fzf --preview 'bat --style=numbers --color=always --line-range :500 {}'

Use rounded cornersJunegunn Choibefore adoption577024f

lines 603–630why, one step back
603```
604605You can customize the size, position, and border of the preview window using606`--preview-window` option, and the foreground and background color of it with607`--color` option. For example,608609```bash610fzf --height 40% --layout reverse --info inline --border \611 --preview 'file {}' --preview-window down:1:noborder \612 --color 'fg:#bbccdd,fg+:#ddeeff,bg:#334455,preview-bg:#223344,border:#778899'613```614615See the man page (`man fzf`) for the full list of options.616617For more advanced examples, see [Key bindings for git with fzf][fzf-git]618([code](https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f17236)).619620[fzf-git]: https://junegunn.kr/2016/07/fzf-git/621622----623624Since fzf is a general-purpose text filter rather than a file finder, **it is625not a good idea to add `--preview` option to your `$FZF_DEFAULT_OPTS`**.626627```sh628# *********************629# ** DO NOT DO THIS! **630# *********************

README: Use --line-range instead of head in bat example (#2064)Janekbefore adoption43d1c4c

line 631why, one step back
631export FZF_DEFAULT_OPTS='--preview "bat --style=numbers --color=always --line-range :500 {}"'

Use rounded cornersJunegunn Choibefore adoption577024f

lines 632–700why, one step back
632
633# bat doesn't work with any input other than the list of files634ps -ef | fzf635seq 100 | fzf636history | fzf637```638639Tips640----641642#### Respecting `.gitignore`643644You can use [fd](https://github.com/sharkdp/fd),645[ripgrep](https://github.com/BurntSushi/ripgrep), or [the silver646searcher](https://github.com/ggreer/the_silver_searcher) instead of the647default find command to traverse the file system while respecting648`.gitignore`.649650```sh651# Feed the output of fd into fzf652fd --type f | fzf653654# Setting fd as the default source for fzf655export FZF_DEFAULT_COMMAND='fd --type f'656657# Now fzf (w/o pipe) will use fd instead of find658fzf659660# To apply the command to CTRL-T as well661export FZF_CTRL_T_COMMAND="$FZF_DEFAULT_COMMAND"662```663664If you want the command to follow symbolic links, and don't want it to exclude665hidden files, use the following command:666667```sh668export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'669```670671#### Fish shell672673`CTRL-T` key binding of fish, unlike those of bash and zsh, will use the last674token on the command-line as the root directory for the recursive search. For675instance, hitting `CTRL-T` at the end of the following command-line676677```sh678ls /var/679```680681will list all files and directories under `/var/`.682683When using a custom `FZF_CTRL_T_COMMAND`, use the unexpanded `$dir` variable to684make use of this feature. `$dir` defaults to `.` when the last token is not a685valid directory. Example:686687```sh688set -g FZF_CTRL_T_COMMAND "command find -L \$dir -type f 2> /dev/null | sed '1d; s#^\./##'"689```690691Related projects692----------------693694https://github.com/junegunn/fzf/wiki/Related-projects695696[License](LICENSE)697------------------698699The MIT License (MIT)700

Update copyright year (#1832)Shun Sakaibefore adoption3918c45

line 701why, one step back
701Copyright (c) 2013-2020 Junegunn Choi