Skip to content
Myr

Update README

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 5e120e7 · Browse files · 1 file+14 added−73 removed
This commit

State

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

Diff stats

1 file+14 added−73 removed

  • other:+14 added−73 removed

1 file+14 added−73 removed

modified:README.md+14 added-73 removed
43 unmodified lines
44git clone --depth 1 https://github.com/junegunn/fzf.git ~/.fzf45~/.fzf/install46```4748#### Using curl4950In case you don't have git installed:5152```sh53mkdir -p ~/.fzf54curl -L https://github.com/junegunn/fzf/archive/master.tar.gz |55 tar xz --strip-components 1 -C ~/.fzf56~/.fzf/install57```5848#### Using Homebrew4950On OS X, you can use [Homebrew](http://brew.sh/) to install fzf.51
93 unmodified lines
145 - Sort is disabled by default to respect chronological ordering146 - Press `CTRL-R` again to toggle sort147- `ALT-C` - cd into the selected directory148160If you're on a tmux session, `CTRL-T` will launch fzf in a new split-window. You161may disable this tmux integration by setting `FZF_TMUX` to 0, or change the162height of the window with `FZF_TMUX_HEIGHT` (e.g. `20`, `50%`).149If you're on a tmux session, fzf will start in a split pane. You may disable150this tmux integration by setting `FZF_TMUX` to 0, or change the height of the151pane with `FZF_TMUX_HEIGHT` (e.g. `20`, `50%`).152153If you use vi mode on bash, you need to add `set -o vi` *before* `source154~/.fzf.bash` in your .bashrc, so that it correctly sets up key bindings for vi155mode.156168If you want to customize the key bindings, consider editing the169installer-generated source code: `~/.fzf.bash`, `~/.fzf.zsh`, and170`~/.config/fish/functions/fzf_key_bindings.fish`.171157`fzf-tmux` script158-----------------159160[fzf-tmux](bin/fzf-tmux) is a bash script that opens fzf in a tmux pane.
109 unmodified lines
270`CTRL-T`, `CTRL-X` or `CTRL-V` to open selected files in the current window,271in new tabs, in horizontal splits, or in vertical splits respectively.272273Note that the environment variables `FZF_DEFAULT_COMMAND` and289`FZF_DEFAULT_OPTS` also apply here. Refer to [the wiki page][vim-examples] for274`FZF_DEFAULT_OPTS` also apply here. Refer to [the wiki page][fzf-config] for275customization.276292[vim-examples]: https://github.com/junegunn/fzf/wiki/Examples-(vim)277[fzf-config]: https://github.com/junegunn/fzf/wiki/Configuring-FZF-command-(vim)278279#### `fzf#run([options])`280281For more advanced uses, you can call `fzf#run()` function which returns the list
77 unmodified lines
359360#### Articles361362- [fzf+vim+tmux](http://junegunn.kr/2014/04/fzf+vim+tmux)363- [Browsing git commits with fzf](http://junegunn.kr/2015/03/browsing-git-commits-with-fzf/)364- [Browsing Chrome history with fzf](http://junegunn.kr/2015/04/browsing-chrome-history-with-fzf/)365- [Browsing Chrome bookmarks with fzf](http://junegunn.kr/2015/04/browsing-chrome-bookmarks-with-fzf/)366367Tips368----369
1 unmodified line
371372If you have any rendering issues, check the followings:3733741. Make sure `$TERM` is correctly set. fzf will use 256-color only if it387 contains `256` (e.g. `xterm-256color`)375 contains `256` (e.g. `xterm-256color`)3762. If you're on screen or tmux, `$TERM` should be either `screen` or389 `screen-256color`377 `screen-256color`3783. Some terminal emulators (e.g. mintty) have problem displaying default391 background color and make some text unable to read. In that case, try `--black`392 option. And if it solves your problem, I recommend including it in393 `FZF_DEFAULT_OPTS` for further convenience.379 background color and make some text unable to read. In that case, try380 `--black` option. And if it solves your problem, I recommend including it381 in `FZF_DEFAULT_OPTS` for further convenience.3824. If you still have problem, try `--no-256` option or even `--no-color`.383384#### Respecting `.gitignore`, `.hgignore`, and `svn:ignore`385
22 unmodified lines
408 (git ls-tree -r --name-only HEAD ||409 find * -name ".*" -prune -o -type f -print -o -type l -print) 2> /dev/null'410```411424#### Using fzf with tmux panes425426The supplied [fzf-tmux](bin/fzf-tmux) script should suffice in most of the427cases, but if you want to be able to update command line like the default428`CTRL-T` key binding, you'll have to use `send-keys` command of tmux. The429following example will show you how it can be done.430431```sh432# This is a helper function that splits the current pane to start the given433# command ($1) and sends its output back to the original pane with any number of434# optional keys (shift; $*).435fzf_tmux_helper() {436 [ -n "$TMUX_PANE" ] || return437 local cmd=$1438 shift439 tmux split-window -p 40 \440 "bash -c \"\$(tmux send-keys -t $TMUX_PANE \"\$(source ~/.fzf.bash; $cmd)\" $*)\""441}442443# This is the function we are going to run in the split pane.444# - "find" to list the directories445# - "sed" will escape spaces in the paths.446# - "paste" will join the selected paths into a single line447fzf_tmux_dir() {448 fzf_tmux_helper \449 'find * -path "*/\.*" -prune -o -type d -print 2> /dev/null |450 fzf --multi |451 sed "s/ /\\\\ /g" |452 paste -sd" " -' Space453}454455# Bind CTRL-X-CTRL-D to fzf_tmux_dir456bind '"\C-x\C-d": "$(fzf_tmux_dir)\e\C-e"'457```458412#### Fish shell413414It's [a known bug of fish](https://github.com/fish-shell/fish-shell/issues/1362)415that it doesn't allow reading from STDIN in command substitution, which means416simple `vim (fzf)` won't work as expected. The workaround is to store the result417of fzf to a temporary file.418419```sh467function vimf468 if fzf > $TMPDIR/fzf.result469 vim (cat $TMPDIR/fzf.result)470 end471end472473function fe474 set tmp $TMPDIR/fzf.result475 fzf --query="$argv[1]" --select-1 --exit-0 > $tmp476 if [ (cat $tmp | wc -l) -gt 0 ]477 vim (cat $tmp)478 end479end420fzf > $TMPDIR/fzf.result; and vim (cat $TMPDIR/fzf.result)421```422423#### Handling UTF-8 NFD paths on OSX424
15 unmodified lines