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
Provenance
- Commit
684bfff- Tree
ba06a81- Author
Junegunn Choi <junegunn.c@gmail.com>- Committer
Junegunn Choi <junegunn.c@gmail.com>- Parent
3db6b88
2 files changed+34 added−48 removed
modified:CHANGELOG.md+2 added
7 unmodified lines8 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 linesmodified:README.md+32 added-48 removed
52 unmodified lines53 * [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 lines498 # Use head instead of cat so that the command doesn't take too long to finish499 fzf --preview 'head -100 {}'500 ```501 503-Preview window supports ANSI colors, so you can use programs that502+Preview window supports ANSI colors, so you can use any program that503 syntax-highlights the content of a file.504 505 - 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/rouge507 508 ```bash512-# Try bat, highlight, coderay, rougify in turn, then fall back to cat513-fzf --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'509+fzf --preview 'bat --style=numbers --color=always {} | head -500'510 ```511 522-You can customize the size and position of the preview window using523-`--preview-window` option. For example,512+You 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,515 516 ```bash526-fzf --height 40% --reverse --preview 'file {}' --preview-window down:1517+fzf --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 ```521 522+See the man page (`man fzf`) for the full list of options.523+524 For more advanced examples, see [Key bindings for git with fzf][fzf-git]525 ([code](https://gist.github.com/junegunn/8b572b8d4b5eddd8b85e5f4d40f17236)).526 527 [fzf-git]: https://junegunn.kr/2016/07/fzf-git/528 529+----530+531+Since fzf is a general-purpose text filter rather than a file finder, **it is532+not a good idea to add `--preview` option to your `$FZF_DEFAULT_OPTS`**.533+534+```sh535+# *********************536+# ** DO NOT DO THIS! **537+# *********************538+export FZF_DEFAULT_OPTS='--preview "bat --style=numbers --color=always {} | head -500"'539+540+# bat doesn't work with any input other than the list of files541+ps -ef | fzf542+seq 100 | fzf543+history | fzf544+```545+546 Tips547 ----548 549 #### Respecting `.gitignore`24 unmodified lines574 ```sh575 export FZF_DEFAULT_COMMAND='fd --type f --hidden --follow --exclude .git'576 ```577 566-#### `git ls-tree` for fast traversal567-568-If you're running fzf in a large git repository, `git ls-tree` can boost up the569-speed of the traversal.570-571-```sh572-export 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-```577-578 #### Fish shell579 580-Fish shell before version 2.6.0 [doesn't allow](https://github.com/fish-shell/fish-shell/issues/1362)581-reading from STDIN in command substitution, which means simple `vim (fzf)`582-doesn't work as expected. The workaround for fish 2.5.0 and earlier is to use583-the `read` fish command:580+`CTRL-T` key binding of fish, unlike those of bash and zsh, will use the last581+token on the command-line as the root directory for the recursive search. For582+instance, hitting `CTRL-T` at the end of the following command-line583 584 ```sh586-fzf | read -l result; and vim $result587-```588-589-or, for multiple results:590-591-```sh592-fzf -m | while read -l r; set result $result $r; end; and vim $result593-```594-595-The globbing system is different in fish and thus `**` completion will not work.596-However, the `CTRL-T` command will use the last token on the command-line as the597-root folder for the recursive search. For instance, hitting `CTRL-T` at the end598-of the following command-line599-600-```sh585 ls /var/586 ```587 604-will list all files and folders under `/var/`.588+will list all files and directories under `/var/`.589 590 When using a custom `FZF_CTRL_T_COMMAND`, use the unexpanded `$dir` variable to591 make use of this feature. `$dir` defaults to `.` when the last token is not a592 valid directory. Example:11 unmodified lines604 ------------------605 606 The MIT License (MIT)607 624-Copyright (c) 2017 Junegunn Choi608+Copyright (c) 2019 Junegunn Choi