Skip to content
Myr

Update README/CHANGELOG

Before adoption: this commit came in with the history the project adopted, so no landing records it.

authored by Junegunn Choi · committed by Junegunn Choi · parent 3db6b88 · Browse files · 2 files+34 added−48 removed
This commit

State

Before adoption: this commit came in with the history the project adopted, so no landing records it.

Diff stats

2 files+34 added−48 removed

  • other:+34 added−48 removed

2 files+34 added−48 removed

modified:CHANGELOG.md+2 added
7 unmodified lines
8 fzf --preview 'cat {}' \9 --color 'fg:#bbccdd,fg+:#ddeeff,bg:#334455,preview-bg:#223344,border:#778899' \10 --border --height 20 --layout reverse --info inline11 ```12- Preview window border can be disabled by setting `noborder` in13 `--preview-window`14- Removed the immediate flicking of the screen on `reload` action.15 ```sh16 : | fzf --bind 'change:reload:seq {q}' --phony17 ```
787 unmodified lines
modified:README.md+32 added-48 removed
52 unmodified lines
53 * [Executing external programs](#executing-external-programs)54 * [Preview window](#preview-window)55 * [Tips](#tips)56 * [Respecting .gitignore](#respecting-gitignore)57 * [git ls-tree for fast traversal](#git-ls-tree-for-fast-traversal)57 * [Fish shell](#fish-shell)58 * [Related projects](#related-projects)59 * [<a href="LICENSE">License</a>](#license)60
437 unmodified lines
498# Use head instead of cat so that the command doesn't take too long to finish499fzf --preview 'head -100 {}'500```501503Preview window supports ANSI colors, so you can use programs that502Preview window supports ANSI colors, so you can use any program that503syntax-highlights the content of a file.504505- Bat: https://github.com/sharkdp/bat506- Highlight: http://www.andre-simon.de/doku/highlight/en/highlight.php508- CodeRay: http://coderay.rubychan.de/509- Rouge: https://github.com/jneen/rouge507508```bash512# Try bat, highlight, coderay, rougify in turn, then fall back to cat513fzf --preview '[[ $(file --mime {}) =~ binary ]] &&514 echo {} is a binary file ||515 (bat --style=numbers --color=always {} ||516 highlight -O ansi -l {} ||517 coderay {} ||518 rougify {} ||519 cat {}) 2> /dev/null | head -500'509fzf --preview 'bat --style=numbers --color=always {} | head -500'510```511522You can customize the size and position of the preview window using523`--preview-window` option. For example,512You can customize the size, position, and border of the preview window using513`--preview-window` option, and the foreground and background color of it with514`--color` option. For example,515516```bash526fzf --height 40% --reverse --preview 'file {}' --preview-window down:1517fzf --height 40% --layout reverse --info inline --border \518 --preview 'file {}' --preview-window down:1:noborder \519 --color 'fg:#bbccdd,fg+:#ddeeff,bg:#334455,preview-bg:#223344,border:#778899'520```521522See the man page (`man fzf`) for the full list of options.523524For more advanced examples, see [Key bindings for git with fzf][fzf-git]525([code](https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f17236)).526527[fzf-git]: https://junegunn.kr/2016/07/fzf-git/528529----530531Since fzf is a general-purpose text filter rather than a file finder, **it is532not a good idea to add `--preview` option to your `$FZF_DEFAULT_OPTS`**.533534```sh535# *********************536# ** DO NOT DO THIS! **537# *********************538export FZF_DEFAULT_OPTS='--preview "bat --style=numbers --color=always {} | head -500"'539540# bat doesn't work with any input other than the list of files541ps -ef | fzf542seq 100 | fzf543history | fzf544```545546Tips547----548549#### Respecting `.gitignore`
24 unmodified lines
574```sh575export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'576```577566#### `git ls-tree` for fast traversal567568If you're running fzf in a large git repository, `git ls-tree` can boost up the569speed of the traversal.570571```sh572export FZF_DEFAULT_COMMAND='573 (git ls-tree -r --name-only HEAD ||574 find . -path "*/\.*" -prune -o -type f -print -o -type l -print |575 sed s/^..//) 2> /dev/null'576```577578#### Fish shell579580Fish shell before version 2.6.0 [doesn't allow](https://github.com/fish-shell/fish-shell/issues/1362)581reading from STDIN in command substitution, which means simple `vim (fzf)`582doesn't work as expected. The workaround for fish 2.5.0 and earlier is to use583the `read` fish command:580`CTRL-T` key binding of fish, unlike those of bash and zsh, will use the last581token on the command-line as the root directory for the recursive search. For582instance, hitting `CTRL-T` at the end of the following command-line583584```sh586fzf | read -l result; and vim $result587```588589or, for multiple results:590591```sh592fzf -m | while read -l r; set result $result $r; end; and vim $result593```594595The globbing system is different in fish and thus `**` completion will not work.596However, the `CTRL-T` command will use the last token on the command-line as the597root folder for the recursive search. For instance, hitting `CTRL-T` at the end598of the following command-line599600```sh585ls /var/586```587604will list all files and folders under `/var/`.588will list all files and directories under `/var/`.589590When using a custom `FZF_CTRL_T_COMMAND`, use the unexpanded `$dir` variable to591make use of this feature. `$dir` defaults to `.` when the last token is not a592valid directory. Example:
11 unmodified lines
604------------------605606The MIT License (MIT)607624Copyright (c) 2017 Junegunn Choi608Copyright (c) 2019 Junegunn Choi